Class OnPropertyUpdateRuleTrigger

java.lang.Object
org.alfresco.repo.rule.ruletrigger.RuleTriggerAbstractBase
fr.becpg.repo.rule.OnPropertyUpdateRuleTrigger
All Implemented Interfaces:
org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy, org.alfresco.repo.policy.ClassPolicy, org.alfresco.repo.policy.Policy, org.alfresco.repo.rule.ruletrigger.RuleTrigger

public class OnPropertyUpdateRuleTrigger extends org.alfresco.repo.rule.ruletrigger.RuleTriggerAbstractBase implements org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
On propety update trigger
Author:
Roy Wetherall
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy

    org.alfresco.repo.policy.Policy.Arg
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
    Should we consider zero byte content to be the same as no content?
    private boolean
     
    private static org.apache.commons.logging.Log
    The logger
    private boolean
    True trigger on new content, false otherwise
    private org.alfresco.repo.rule.RuntimeRuleService
    Runtime rule service
    private boolean
    True trigger parent rules, false otherwise

    Fields inherited from class org.alfresco.repo.rule.ruletrigger.RuleTriggerAbstractBase

    authenticationComponent, contentService, dictionaryService, executeRuleImmediately, nodeService, policyComponent, ruleService

    Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy

    ARG_0, ARG_1, ARG_2, QNAME

    Fields inherited from interface org.alfresco.repo.policy.Policy

    NAMESPACE

    Fields inherited from interface org.alfresco.repo.rule.ruletrigger.RuleTrigger

    RULE_TRIGGER_NEW_NODES, RULE_TRIGGER_RENAMED_NODES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    havePropertiesBeenModified(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after, boolean newNode, boolean newContentOnly)
     
    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)
    Triggers rules if properties have been updated
    void
    registerRuleTrigger.
    void
    setIgnoreEmptyContent(boolean ignoreEmptyContent)
    If set to true, then we consider zero byte content to be equivalent to no content.
    void
    setIgnoreEntityDataList(boolean ignoreEntityDataList)
    Setter for the field ignoreEntityDataList.
    void
    setOnNewContent(boolean onNewContent)
    If set to true the trigger will fire on new content, otherwise it will fire on content update
    void
    setRuntimeRuleService(org.alfresco.repo.rule.RuntimeRuleService runtimeRuleService)
    Set the rule service
    void
    setTriggerParentRules(boolean triggerParentRules)
    Indicates whether the parent rules should be triggered or the rules on the node itself
    private static org.alfresco.service.cmr.repository.ContentData
    ALF-17483: It's possible that even for a single-valued contentdata property, its definition may have been changed and the previous persisted value is multi-valued, so let's be careful about converting to ContentData.
    private void
    triggerRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
     

    Methods inherited from class org.alfresco.repo.rule.ruletrigger.RuleTriggerAbstractBase

    areRulesEnabled, getIgnoredAspects, getIgnoredTypes, ignoreTrigger, registerRuleType, setAuthenticationComponent, setContentService, setDictionaryService, setExecuteRuleImmediately, setIgnoredAspectsStr, setIgnoredTypeStr, setNodeService, setPolicyComponent, setRuleService, triggerRules

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static org.apache.commons.logging.Log logger
      The logger
    • onNewContent

      private boolean onNewContent
      True trigger on new content, false otherwise
    • ignoreEmptyContent

      private boolean ignoreEmptyContent
      Should we consider zero byte content to be the same as no content?
    • ignoreEntityDataList

      private boolean ignoreEntityDataList
    • triggerParentRules

      private boolean triggerParentRules
      True trigger parent rules, false otherwise
    • runtimeRuleService

      private org.alfresco.repo.rule.RuntimeRuleService runtimeRuleService
      Runtime rule service
  • Constructor Details

    • OnPropertyUpdateRuleTrigger

      public OnPropertyUpdateRuleTrigger()
  • Method Details

    • setOnNewContent

      public void setOnNewContent(boolean onNewContent)
      If set to true the trigger will fire on new content, otherwise it will fire on content update
      Parameters:
      onNewContent - indicates whether to fire on content create or update
    • setIgnoreEmptyContent

      public void setIgnoreEmptyContent(boolean ignoreEmptyContent)
      If set to true, then we consider zero byte content to be equivalent to no content.
      Parameters:
      ignoreEmptyContent - boolean
    • setTriggerParentRules

      public void setTriggerParentRules(boolean triggerParentRules)
      Indicates whether the parent rules should be triggered or the rules on the node itself
      Parameters:
      triggerParentRules - true trigger parent rules, false otherwise
    • setRuntimeRuleService

      public void setRuntimeRuleService(org.alfresco.repo.rule.RuntimeRuleService runtimeRuleService)
      Set the rule service
      Parameters:
      runtimeRuleService - a RuntimeRuleService object
    • setIgnoreEntityDataList

      public void setIgnoreEntityDataList(boolean ignoreEntityDataList)

      Setter for the field ignoreEntityDataList.

      Parameters:
      ignoreEntityDataList - a boolean
    • registerRuleTrigger

      public void registerRuleTrigger()

      registerRuleTrigger.

      Specified by:
      registerRuleTrigger in interface org.alfresco.repo.rule.ruletrigger.RuleTrigger
    • havePropertiesBeenModified

      private boolean havePropertiesBeenModified(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after, boolean newNode, boolean newContentOnly)
    • toContentData

      private static org.alfresco.service.cmr.repository.ContentData toContentData(Object object)
      ALF-17483: It's possible that even for a single-valued contentdata property, its definition may have been changed and the previous persisted value is multi-valued, so let's be careful about converting to ContentData.
      Parameters:
      object - property value to convert
      Returns:
      a ContentData if one can be extracted
    • 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)
      Triggers rules if properties have been updated
      Specified by:
      onUpdateProperties in interface org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy
    • triggerRules

      private void triggerRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Parameters:
      nodeRef - NodeRef