Class EntityActivityPolicy

java.lang.Object
fr.becpg.repo.policy.AbstractBeCPGPolicy
fr.becpg.repo.activity.policy.EntityActivityPolicy
All Implemented Interfaces:
org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy, org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy, org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateAssociationPolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy, org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnRestoreNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.policy.AssociationPolicy, org.alfresco.repo.policy.ClassPolicy, org.alfresco.repo.policy.Policy

public class EntityActivityPolicy extends AbstractBeCPGPolicy implements org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy, org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnCreateAssociationPolicy, org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy, org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy, org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy, org.alfresco.repo.node.NodeServicePolicies.OnRestoreNodePolicy

EntityActivityPolicy class.

Version:
$Id: $Id
Author:
matthieu
  • Field Details

    • logger

      private static final org.apache.commons.logging.Log logger
      Constant logger
    • KEY_QUEUE_UPDATED

      public static final String KEY_QUEUE_UPDATED
      Constant KEY_QUEUE_UPDATED="EntityActivity_updated"
      See Also:
    • KEY_QUEUE_DELETED

      public static final String KEY_QUEUE_DELETED
      Constant KEY_QUEUE_DELETED="EntityActivity_deleted"
      See Also:
    • KEY_QUEUE_CREATED

      public static final String KEY_QUEUE_CREATED
      Constant KEY_QUEUE_CREATED="EntityActivity_created"
      See Also:
    • KEY_QUEUE_UPDATED_STATUS

      public static final String KEY_QUEUE_UPDATED_STATUS
      Constant KEY_QUEUE_UPDATED_STATUS="EntityActivity_UpdatedStatus"
      See Also:
    • KEY_QUEUE_ADDED_TPL_ASPECT

      public static final String KEY_QUEUE_ADDED_TPL_ASPECT
      Constant KEY_QUEUE_ADDED_TPL_ASPECT="EntityActivity_AddedTplAspect"
      See Also:
    • KEY_IGNORE_MOVE_ACTIVITIES

      public static final String KEY_IGNORE_MOVE_ACTIVITIES
      See Also:
    • KEY_RESTORING_ARCHIVED_NODE

      private static final String KEY_RESTORING_ARCHIVED_NODE
      Constant KEY_RESTORING_ARCHIVED_NODE="EntityActivity_RestoringArchivedNode"
      See Also:
    • DELIMITER

      private static final String DELIMITER
      Constant DELIMITER="###"
      See Also:
    • pattern

      private static final Pattern pattern
      Constant pattern
    • entityActivityService

      private EntityActivityService entityActivityService
    • entityDictionaryService

      private EntityDictionaryService entityDictionaryService
  • Constructor Details

    • EntityActivityPolicy

      public EntityActivityPolicy()
  • Method Details

    • setEntityActivityService

      public void setEntityActivityService(EntityActivityService entityActivityService)

      Setter for the field entityActivityService.

      Parameters:
      entityActivityService - a EntityActivityService object.
    • setEntityDictionaryService

      public void setEntityDictionaryService(EntityDictionaryService entityDictionaryService)

      Setter for the field entityDictionaryService.

      Parameters:
      entityDictionaryService - a EntityDictionaryService object.
    • doInit

      public void doInit()

      doInit.

      Inits the.
      Specified by:
      doInit in class AbstractBeCPGPolicy
    • getCopyCallback

      public org.alfresco.repo.copy.CopyBehaviourCallback getCopyCallback(org.alfresco.service.namespace.QName classRef, org.alfresco.repo.copy.CopyDetails copyDetails)
      Specified by:
      getCopyCallback in interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
      Overrides:
      getCopyCallback in class AbstractBeCPGPolicy
    • ignoreType

      public boolean ignoreType(org.alfresco.service.namespace.QName type, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)

      ignoreType.

      Parameters:
      type - a QName object.
      before - a Map object.
      after - a Map object.
      Returns:
      a boolean.
    • onMoveNode

      public void onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef oldChildAssocRef, org.alfresco.service.cmr.repository.ChildAssociationRef newChildAssocRef)
      Specified by:
      onMoveNode in interface org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy
    • onAddAspect

      public void onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspectTypeQName)
      Specified by:
      onAddAspect in interface org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy
    • onUpdateProperties

      public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)
      Specified by:
      onUpdateProperties in interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
    • onCreateAssociation

      public void onCreateAssociation(org.alfresco.service.cmr.repository.AssociationRef assocRef)
      Specified by:
      onCreateAssociation in interface org.alfresco.repo.node.NodeServicePolicies.OnCreateAssociationPolicy
    • onDeleteAssociation

      public void onDeleteAssociation(org.alfresco.service.cmr.repository.AssociationRef assocRef)
      Specified by:
      onDeleteAssociation in interface org.alfresco.repo.node.NodeServicePolicies.OnDeleteAssociationPolicy
    • onContentUpdate

      public void onContentUpdate(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)
      Specified by:
      onContentUpdate in interface org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy
    • onCreateNode

      public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Specified by:
      onCreateNode in interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
    • beforeDeleteNode

      public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Specified by:
      beforeDeleteNode in interface org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy
    • onRestoreNode

      public void onRestoreNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
      Restoring an archived node is a cross-store move: Alfresco replays a creation for every descendant, which would turn a single restore into one activity per node. Those activities describe no user edit and, piled up in the single transaction of the restore, exhaust both the heap and the database locks, so the whole restore fails. Alfresco fires the same policy for a locked node on its way to the archive, hence the check on the destination store: only a node coming back to the live store is being restored.
      Specified by:
      onRestoreNode in interface org.alfresco.repo.node.NodeServicePolicies.OnRestoreNodePolicy
    • isArchived

      private boolean isArchived(org.alfresco.service.cmr.repository.NodeRef nodeRef)

      Tells whether the node lives in the archive store, where activities are pointless: an archived node is only reachable from the trashcan, and both archiving and restoring walk the whole subtree.

      Parameters:
      nodeRef - a NodeRef object
      Returns:
      true when the node has been archived
    • doBeforeCommit

      protected boolean doBeforeCommit(String key, Set<org.alfresco.service.cmr.repository.NodeRef> pendingNodes)

      doBeforeCommit.

      Overrides:
      doBeforeCommit in class AbstractBeCPGPolicy
      Parameters:
      key - a String object.
      pendingNodes - a Set object.
      Returns:
      a boolean.
    • accept

      private boolean accept(org.alfresco.service.namespace.QName type)

      accept.

      Parameters:
      type - a QName object
      Returns:
      a boolean
    • registerActivity

      private void registerActivity(org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, org.alfresco.service.namespace.QName type, ActivityEvent activityEvent)

      registerActivity.

      Parameters:
      actionedUponNodeRef - a NodeRef object
      type - a QName object
      activityEvent - a ActivityEvent object