Class DefaultAggregateHandler

java.lang.Object
com.day.cq.replication.DefaultAggregateHandler
All Implemented Interfaces:
AggregateHandler

public class DefaultAggregateHandler extends Object implements AggregateHandler
Implements an aggregate handler that detects hierarchy nodes as aggregate root.
  • Constructor Details

    • DefaultAggregateHandler

      public DefaultAggregateHandler()
  • Method Details

    • isRemoveNodes

      public boolean isRemoveNodes()
      Checks if this handler removes the nodes in the processForReplication(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 the processForReplication(javax.jcr.Session, ReplicationAction). the default is false.
      Parameters:
      removeNodes - the flag
    • isAggregateRoot

      public boolean isAggregateRoot(Node node)
      Checks if the given node is an aggregate root.
      Specified by:
      isAggregateRoot in interface AggregateHandler
      Parameters:
      node - node to test
      Returns:
      true if 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 match isAggregateRoot(javax.jcr.Node) recursively, but only for DELETE and DEACTIVATE action types.
      Specified by:
      prepareForReplication in interface AggregateHandler
      Parameters:
      session - session to use for traversal
      type - replication action type
      path - 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:
      processForReplication in interface AggregateHandler
      Parameters:
      session - the session to use to process the content
      action - the replication action
      Throws:
      ReplicationException - to abort the replication in the preparation stage