Class DefaultAggregateHandler

  • All Implemented Interfaces:

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

      • DefaultAggregateHandler

        public DefaultAggregateHandler()
    • Method Detail

      • isAggregateRoot

        public boolean isAggregateRoot​(Node node)
        Checks if the given node is an aggregate root.
        Specified by:
        isAggregateRoot in interface AggregateHandler
        node - node to test
        true if the node is a hierarchy node.
      • prepareForReplication

        public java.util.List<java.lang.String> prepareForReplication​(Session session,
                                                                      ReplicationActionType type,
                                                                      java.lang.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
        session - session to use for traversal
        type - replication action type
        path - start path
        a list of aggregate roots.
        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
        session - the session to use to process the content
        action - the replication action
        ReplicationException - to abort the replication in the preparation stage