Interface RuleService

All Known Implementing Classes:
RuleServiceImpl

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

    • getRuleTypes

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

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

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

      @Auditable void disableRules()
      Disable rules for the current thread
      See Also:
    • 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:
    • rulesEnabled

      @Auditable(parameters="nodeRef") boolean rulesEnabled(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(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(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

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

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

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

      @Auditable(parameters="ruleType") boolean isRuleTypeEnabled(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(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") List<Rule> getRules(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"}) List<Rule> getRules(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"}) List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, 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(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(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(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(NodeRef nodeRef, Rule rule, int index)
      Parameters:
      nodeRef - NodeRef
      rule - Rule
      index - int
    • setRulePosition

      @Auditable(parameters={"nodeRef","ruleNodeRef","index"}) void setRulePosition(NodeRef nodeRef, NodeRef ruleNodeRef, int index)
      Parameters:
      nodeRef - NodeRef
      ruleNodeRef - NodeRef
      index - int
    • setRulePosition

      @Auditable(parameters={"nodeRef","rule","index"}) void setRulePosition(NodeRef nodeRef, Rule rule, int index)
      Parameters:
      nodeRef - NodeRef
      rule - Rule
      index - int
    • removeRule

      @Auditable(parameters={"nodeRef","rule"}) void removeRule(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(NodeRef nodeRef)
      Removes all the rules associated with an actionable node
      Parameters:
      nodeRef - the actionable node reference
    • getOwningNodeRef

      @Auditable(parameters="rule") 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") 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(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") NodeRef getLinkedToRuleNode(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") List<NodeRef> getLinkedFromRuleNodes(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