Package org.alfresco.service.cmr.rule
Interface RuleService
- All Known Implementing Classes:
RuleServiceImpl
public interface RuleService
Rule service interface.
- Author:
- Roy Wetherall
-
Method Summary
Modifier and TypeMethodDescriptionintcountRules(NodeRef nodeRef) Count the number of rules associated with an actionable node.voiddisableRule(Rule rule) Disables a rule, preventing it from being fired.voidDisable rules for the current threadvoiddisableRules(NodeRef nodeRef) Disables the rules for a given node reference.voiddisableRuleType(String ruleType) Disables the rules of a given type.voidenableRule(Rule rule) Enables a rule previously disabled.voidEnable rules for the current threadvoidenableRules(NodeRef nodeRef) Enables the rules for a given node reference.voidenableRuleType(String ruleType) Enables rules of a given type.getFoldersInheritingRuleSet(NodeRef ruleSet, int maxFoldersToReturn) Get a list of folders inheriting the specified rule set.getFoldersLinkingToRuleSet(NodeRef ruleSet, int maxFoldersToReturn) Get a list of folders linking to the specified rule set.getLinkedFromRuleNodes(NodeRef nodeRef) Get a list of the all the rule nodes that link to the passed rule node.getLinkedToRuleNode(NodeRef nodeRef) Get the node reference to the rule node which the rule node links to.getNodesSupplyingRuleSets(NodeRef nodeRef) Traverse the folder hierarchy find all the folder nodes that could supply rules by inheritance.getOwningNodeRef(Action action) Returns the owning node reference for an action.getOwningNodeRef(NodeRef ruleSet) Returns the owning node reference for a rule.getOwningNodeRef(Rule rule) Returns the owning node reference for a rule.Get the rule given its node referenceGet all the rules associated with an actionable node, including those inherited from parents.Get the rules associated with an actionable node.Get the rules associated with an actionable node that are of a specific rule type.getRuleSetNode(NodeRef folderNodeRef) Get rule set node associated with foldergetRuleType(String name) Gets a rule type by name.Get the rule types currently defined in the repository.booleanhasNonInheritedRules(NodeRef nodeRef) Indicates whether the node in question has any non-inherited rules associated with it.booleanIndicates whether the node in question has any rules associated with it.booleanIndicates whether rules are currently enabled for the current thread or notbooleanisLinkedToRuleNode(NodeRef nodeRef) Indicates whether the passed rule node reference is linked to another rule node.booleanisRuleAssociatedWithRuleSet(NodeRef ruleNodeRef, NodeRef ruleSetNodeRef) Check if rule's associated parent matches rule set node.booleanisRuleSetAssociatedWithFolder(NodeRef ruleSetNodeRef, NodeRef folderNodeRef) Check if rule set is associated (owned/linked/inherited) with the given folder node.booleanisRuleSetShared(NodeRef ruleSetNodeRef) Check if other folders are linked to rule set.booleanisRuleTypeEnabled(String ruleType) Indicates whether the rule is enabled or notvoidremoveAllRules(NodeRef nodeRef) Removes all the rules associated with an actionable nodevoidremoveRule(NodeRef nodeRef, Rule rule) Removes a rule from the given rule actionable nodebooleanrulesEnabled(NodeRef nodeRef) Indicates whether the rules for a given node are enabled or not.Saves the details of the rule to the specified node reference.voidvoidsetRulePosition(NodeRef nodeRef, NodeRef ruleNodeRef, int index) voidsetRulePosition(NodeRef nodeRef, Rule rule, int index)
-
Method Details
-
getRuleTypes
Get the rule types currently defined in the repository.- Returns:
- a list of rule types
-
getRuleType
Gets a rule type by name.- Parameters:
name- the name of the rule type- Returns:
- the rule type, null if not found
-
enableRules
Enable rules for the current thread- See Also:
-
disableRules
Disable rules for the current thread- See Also:
-
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
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
Disables the rules for a given node reference. When the rules are disabled they will not execute.- Parameters:
nodeRef- the node reference
-
enableRules
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
Disables a rule, preventing it from being fired.- Parameters:
rule- the rule to disable- See Also:
-
enableRule
Enables a rule previously disabled.- Parameters:
rule- the rule to enable- See Also:
-
disableRuleType
Disables the rules of a given type.- Parameters:
ruleType- rule type
-
enableRuleType
Enables rules of a given type.- Parameters:
ruleType- rule type
-
isRuleTypeEnabled
Indicates whether the rule is enabled or not- Parameters:
ruleType- rule type- Returns:
- boolean true if enabled false otherwise
-
hasRules
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
-
hasNonInheritedRules
Indicates whether the node in question has any non-inherited rules associated with it.- Parameters:
nodeRef- the node reference- Returns:
- true if the node has rules associated, false otherwise
-
getRules
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 referenceincludeInhertied- 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 referenceincludeInhertiedRuleType- indicates whether the inherited rules should be included in the result list or notruleTypeName- 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
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
-
getNodesSupplyingRuleSets
@Auditable(parameters="nodeRef") @Experimental List<NodeRef> getNodesSupplyingRuleSets(NodeRef nodeRef) Traverse the folder hierarchy find all the folder nodes that could supply rules by inheritance.- Parameters:
nodeRef- The starting node ref.- Returns:
- A list of node refs, starting with the first parent of the first parent of ... and ending with the object generated by the given node ref.
-
getFoldersInheritingRuleSet
@Auditable(parameters={"ruleSet","maxFoldersToReturn"}) @Experimental List<NodeRef> getFoldersInheritingRuleSet(NodeRef ruleSet, int maxFoldersToReturn) Get a list of folders inheriting the specified rule set.- Parameters:
ruleSet- The rule set node.maxFoldersToReturn- A limit on the number of folders to return (since otherwise this could traverse a very large proportion of the repository).- Returns:
- The list of the inheriting folders.
-
getFoldersLinkingToRuleSet
@Auditable(parameters="ruleSet") @Experimental List<NodeRef> getFoldersLinkingToRuleSet(NodeRef ruleSet, int maxFoldersToReturn) Get a list of folders linking to the specified rule set.- Parameters:
ruleSet- The rule set node.maxFoldersToReturn- A limit on the number of folders to return.- Returns:
- The list linking folders.
-
getRule
Get the rule given its node reference- Parameters:
nodeRef- the node reference- Returns:
- the rule corresponding to the node reference
-
saveRule
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- NodeRefrule- Rule
-
saveRule
@Auditable(parameters={"nodeRef","rule","index"}) void saveRule(NodeRef nodeRef, Rule rule, int index) - Parameters:
nodeRef- NodeRefrule- Ruleindex- int
-
setRulePosition
@Auditable(parameters={"nodeRef","ruleNodeRef","index"}) void setRulePosition(NodeRef nodeRef, NodeRef ruleNodeRef, int index) - Parameters:
nodeRef- NodeRefruleNodeRef- NodeRefindex- int
-
setRulePosition
@Auditable(parameters={"nodeRef","rule","index"}) void setRulePosition(NodeRef nodeRef, Rule rule, int index) - Parameters:
nodeRef- NodeRefrule- Ruleindex- int
-
removeRule
Removes a rule from the given rule actionable node- Parameters:
nodeRef- the actionable node reference
-
removeAllRules
Removes all the rules associated with an actionable node- Parameters:
nodeRef- the actionable node reference
-
getOwningNodeRef
Returns the owning node reference for a rule.- Parameters:
rule- the rule- Returns:
- the owning node reference
-
getOwningNodeRef
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
-
getOwningNodeRef
Returns the owning node reference for a rule.- Parameters:
ruleSet- The rule set node.- Returns:
- the owning node reference
-
isLinkedToRuleNode
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
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
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
-
getRuleSetNode
Get rule set node associated with folder- Parameters:
folderNodeRef- - folder node reference- Returns:
- node reference of a rule set
-
isRuleSetAssociatedWithFolder
@Auditable(parameters={"ruleSetNodeRef","folderNodeRef"}) @Experimental boolean isRuleSetAssociatedWithFolder(NodeRef ruleSetNodeRef, NodeRef folderNodeRef) Check if rule set is associated (owned/linked/inherited) with the given folder node.- Parameters:
ruleSetNodeRef- - node reference of a rule setfolderNodeRef- - node reference of a folder- Returns:
- true if rule set is associated with folder
-
isRuleAssociatedWithRuleSet
@Auditable(parameters={"ruleNodeRef","ruleSetNodeRef"}) @Experimental boolean isRuleAssociatedWithRuleSet(NodeRef ruleNodeRef, NodeRef ruleSetNodeRef) Check if rule's associated parent matches rule set node.- Parameters:
ruleNodeRef- - node reference of a ruleruleSetNodeRef- - node reference of a rule set- Returns:
- true if rule is associated with rule set
-