Interface RuleService

  • All Known Implementing Classes:
    RuleServiceImpl

    public interface RuleService
    Rule service interface.
    Author:
    Roy Wetherall
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int countRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Count the number of rules associated with an actionable node.
      void disableRule​(Rule rule)
      Disables a rule, preventing it from being fired.
      void disableRules()
      Disable rules for the current thread
      void disableRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Disables the rules for a given node reference.
      void disableRuleType​(java.lang.String ruleType)
      Disables the rules of a given type.
      void enableRule​(Rule rule)
      Enables a rule previously disabled.
      void enableRules()
      Enable rules for the current thread
      void enableRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Enables the rules for a given node reference.
      void enableRuleType​(java.lang.String ruleType)
      Enables rules of a given type.
      java.util.List<org.alfresco.service.cmr.repository.NodeRef> getLinkedFromRuleNodes​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Get a list of the all the rule nodes that link to the passed rule node.
      org.alfresco.service.cmr.repository.NodeRef getLinkedToRuleNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Get the node reference to the rule node which the rule node links to.
      org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef​(Action action)
      Returns the owning node reference for an action.
      org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef​(Rule rule)
      Returns the owning node reference for a rule.
      Rule getRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Get the rule given its node reference
      java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Get all the rules associated with an actionable node, including those inherited from parents.
      java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean includeInhertied)
      Get the rules associated with an actionable node.
      java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean includeInhertiedRuleType, java.lang.String ruleTypeName)
      Get the rules associated with an actionable node that are of a specific rule type.
      RuleType getRuleType​(java.lang.String name)
      Gets a rule type by name.
      java.util.List<RuleType> getRuleTypes()
      Get the rule types currently defined in the repository.
      boolean hasRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Indicates whether the node in question has any rules associated with it.
      boolean isEnabled()
      Indicates whether rules are currently enabled for the current thread or not
      boolean isLinkedToRuleNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Indicates whether the passed rule node reference is linked to another rule node.
      boolean isRuleTypeEnabled​(java.lang.String ruleType)
      Indicates whether the rule is enabled or not
      void removeAllRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Removes all the rules associated with an actionable node
      void removeRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef, Rule rule)
      Removes a rule from the given rule actionable node
      boolean rulesEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Indicates whether the rules for a given node are enabled or not.
      void saveRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef, Rule rule)
      Saves the details of the rule to the specified node reference.
      void saveRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef, Rule rule, int index)  
      void setRulePosition​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef ruleNodeRef, int index)  
      void setRulePosition​(org.alfresco.service.cmr.repository.NodeRef nodeRef, Rule rule, int index)  
    • Method Detail

      • getRuleTypes

        @Auditable
        java.util.List<RuleType> getRuleTypes()
        Get the rule types currently defined in the repository.
        Returns:
        a list of rule types
      • getRuleType

        @Auditable(parameters="name")
        RuleType getRuleType​(java.lang.String name)
        Gets a rule type by name.
        Parameters:
        name - the name of the rule type
        Returns:
        the rule type, null if not found
      • disableRules

        @Auditable
        void disableRules()
        Disable rules for the current thread
        See Also:
        enableRules(), isEnabled()
      • isEnabled

        @Auditable
        boolean isEnabled()
        Indicates whether rules are currently enabled for the current thread or not
        Returns:
        true if rules are enabled for the current thread, false otherwise
        See Also:
        enableRules(), disableRules()
      • rulesEnabled

        @Auditable(parameters="nodeRef")
        boolean rulesEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Indicates whether the rules for a given node are enabled or not. If the rules are not enabled then they will not be executed.
        Parameters:
        nodeRef - the node reference
        Returns:
        true if the rules are enabled, false otherwise
      • disableRules

        @Auditable(parameters="nodeRef")
        void disableRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Disables the rules for a given node reference. When the rules are disabled they will not execute.
        Parameters:
        nodeRef - the node reference
      • enableRules

        @Auditable(parameters="nodeRef")
        void enableRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Enables the rules for a given node reference. When the rules are enabled they will execute as usual. By default all rules are enabled.
        Parameters:
        nodeRef - the node reference
      • disableRule

        @Auditable(parameters="rule")
        void disableRule​(Rule rule)
        Disables a rule, preventing it from being fired.
        Parameters:
        rule - the rule to disable
        See Also:
        enableRule(Rule)
      • enableRule

        @Auditable(parameters="rule")
        void enableRule​(Rule rule)
        Enables a rule previously disabled.
        Parameters:
        rule - the rule to enable
        See Also:
        disableRule(Rule)
      • disableRuleType

        @Auditable(parameters="ruleType")
        void disableRuleType​(java.lang.String ruleType)
        Disables the rules of a given type.
        Parameters:
        ruleType - rule type
      • enableRuleType

        @Auditable(parameters="ruleType")
        void enableRuleType​(java.lang.String ruleType)
        Enables rules of a given type.
        Parameters:
        ruleType - rule type
      • isRuleTypeEnabled

        @Auditable(parameters="ruleType")
        boolean isRuleTypeEnabled​(java.lang.String ruleType)
        Indicates whether the rule is enabled or not
        Parameters:
        ruleType - rule type
        Returns:
        boolean true if enabled false otherwise
      • hasRules

        @Auditable(parameters="nodeRef")
        boolean hasRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Indicates whether the node in question has any rules associated with it.
        Parameters:
        nodeRef - the node reference
        Returns:
        true if the node has rules associated, false otherwise
      • getRules

        @Auditable(parameters="nodeRef")
        java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Get all the rules associated with an actionable node, including those inherited from parents.

        An exception is raised if the actionable aspect is not present on the passed node.

        Parameters:
        nodeRef - the node reference
        Returns:
        a list of the rules associated with the node
      • getRules

        @Auditable(parameters={"nodeRef","includeInhertied"})
        java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                      boolean includeInhertied)
        Get the rules associated with an actionable node.

        Optionally this list includes rules inherited from its parents.

        An exception is raised if the actionable aspect is not present on the passed node.

        Parameters:
        nodeRef - the node reference
        includeInhertied - indicates whether the inherited rules should be included in the result list or not
        Returns:
        a list of the rules associated with the node
      • getRules

        @Auditable(parameters={"nodeRef","includeInhertiedRuleType","ruleTypeName"})
        java.util.List<Rule> getRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                      boolean includeInhertiedRuleType,
                                      java.lang.String ruleTypeName)
        Get the rules associated with an actionable node that are of a specific rule type.
        Parameters:
        nodeRef - the node reference
        includeInhertiedRuleType - indicates whether the inherited rules should be included in the result list or not
        ruleTypeName - the name of the rule type, if null is passed all rule types are returned
        Returns:
        a list of the rules associated with the node
      • countRules

        @Auditable(parameters="nodeRef")
        int countRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Count the number of rules associated with an actionable node.
        Parameters:
        nodeRef - the node reference
        Returns:
        a list of the rules associated with the node
      • getRule

        @Auditable(parameters="nodeRef")
        Rule getRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Get the rule given its node reference
        Parameters:
        nodeRef - the node reference
        Returns:
        the rule corresponding to the node reference
      • saveRule

        @Auditable(parameters={"nodeRef","rule"})
        void saveRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                      Rule rule)
        Saves the details of the rule to the specified node reference.

        If the rule is already associated with the node, the details are updated with those specified.

        Parameters:
        nodeRef - NodeRef
        rule - Rule
      • saveRule

        @Auditable(parameters={"nodeRef","rule","index"})
        void saveRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                      Rule rule,
                      int index)
        Parameters:
        nodeRef - NodeRef
        rule - Rule
        index - int
      • setRulePosition

        @Auditable(parameters={"nodeRef","ruleNodeRef","index"})
        void setRulePosition​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             org.alfresco.service.cmr.repository.NodeRef ruleNodeRef,
                             int index)
        Parameters:
        nodeRef - NodeRef
        ruleNodeRef - NodeRef
        index - int
      • setRulePosition

        @Auditable(parameters={"nodeRef","rule","index"})
        void setRulePosition​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             Rule rule,
                             int index)
        Parameters:
        nodeRef - NodeRef
        rule - Rule
        index - int
      • removeRule

        @Auditable(parameters={"nodeRef","rule"})
        void removeRule​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                        Rule rule)
        Removes a rule from the given rule actionable node
        Parameters:
        nodeRef - the actionable node reference
      • removeAllRules

        @Auditable(parameters="nodeRef")
        void removeAllRules​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Removes all the rules associated with an actionable node
        Parameters:
        nodeRef - the actionable node reference
      • getOwningNodeRef

        @Auditable(parameters="rule")
        org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef​(Rule rule)
        Returns the owning node reference for a rule.
        Parameters:
        rule - the rule
        Returns:
        the owning node reference
      • getOwningNodeRef

        @Auditable(parameters="action")
        org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef​(Action action)
        Returns the owning node reference for an action. Returns null for an unsaved action or one that is not parented by a rule. NOTE: this method is temporary and will be removed in future versions. It should only be used with good reason.
        Parameters:
        action - the action
        Returns:
        the owning node reference
      • isLinkedToRuleNode

        @Auditable(parameters="nodeRef")
        boolean isLinkedToRuleNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Indicates whether the passed rule node reference is linked to another rule node.
        Parameters:
        nodeRef - rule node reference
        Returns:
        boolean true if linked, false otherwise
      • getLinkedToRuleNode

        @Auditable(parameters="nodeRef")
        org.alfresco.service.cmr.repository.NodeRef getLinkedToRuleNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Get the node reference to the rule node which the rule node links to. Returns null if rules are not linked.
        Parameters:
        nodeRef - node reference of a rule node
        Returns:
        NodeRef reference to the
      • getLinkedFromRuleNodes

        @Auditable(parameters="nodeRef")
        java.util.List<org.alfresco.service.cmr.repository.NodeRef> getLinkedFromRuleNodes​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Get a list of the all the rule nodes that link to the passed rule node. Returns an empty list if none link.
        Parameters:
        nodeRef - node reference of a rule node
        Returns:
        list of rule nodes that link to this passed rule node, empty if none