Package com.day.cq.replication
Class DefaultAggregateHandler
java.lang.Object
com.day.cq.replication.DefaultAggregateHandler
- All Implemented Interfaces:
AggregateHandler
Implements an aggregate handler that detects hierarchy nodes as aggregate root.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisAggregateRoot(Node node) Checks if the given node is an aggregate root.booleanChecks if this handler removes the nodes in theprocessForReplication(javax.jcr.Session, ReplicationAction)for a delete replication.prepareForReplication(Session session, ReplicationActionType type, String path) Returns a list of aggregate roots of the subtree starting at the specified path that are relevant for the given replication action.voidprocessForReplication(Session session, ReplicationAction action) Processes the aggregate addressed by the replication action.voidsetRemoveNodes(boolean removeNodes) Sets the flag that controls if this handler should remove the node in theprocessForReplication(javax.jcr.Session, ReplicationAction).
-
Constructor Details
-
DefaultAggregateHandler
public DefaultAggregateHandler()
-
-
Method Details
-
isRemoveNodes
public boolean isRemoveNodes()Checks if this handler removes the nodes in theprocessForReplication(javax.jcr.Session, ReplicationAction)for a delete replication.- Returns:
- the remove nodes flag.
-
setRemoveNodes
public void setRemoveNodes(boolean removeNodes) Sets the flag that controls if this handler should remove the node in theprocessForReplication(javax.jcr.Session, ReplicationAction). the default isfalse.- Parameters:
removeNodes- the flag
-
isAggregateRoot
Checks if the given node is an aggregate root.- Specified by:
isAggregateRootin interfaceAggregateHandler- Parameters:
node- node to test- Returns:
trueif the node is a hierarchy node.
-
prepareForReplication
public List<String> prepareForReplication(Session session, ReplicationActionType type, String path) throws ReplicationException Returns a list of aggregate roots of the subtree starting at the specified path that are relevant for the given replication action. The specified start path should be included in the list in any case. Returns the all aggregate roots that matchisAggregateRoot(javax.jcr.Node)recursively, but only for DELETE and DEACTIVATE action types.- Specified by:
prepareForReplicationin interfaceAggregateHandler- Parameters:
session- session to use for traversaltype- replication action typepath- start path- Returns:
- a list of aggregate roots.
- Throws:
ReplicationException- to abort the replication in the preparation stage
-
processForReplication
public void processForReplication(Session session, ReplicationAction action) throws ReplicationException Processes the aggregate addressed by the replication action. The aggregate handler may or may not save the changes. Deletes all paths passed by the action. but only for DELETE actions. The changes are not saved.- Specified by:
processForReplicationin interfaceAggregateHandler- Parameters:
session- the session to use to process the contentaction- the replication action- Throws:
ReplicationException- to abort the replication in the preparation stage
-