public class RuleServiceImpl extends java.lang.Object implements RuleService, RuntimeRuleService, NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy, NodeServicePolicies.OnUpdateNodePolicy, NodeServicePolicies.OnAddAspectPolicy
This service automatically binds to the transaction flush hooks. It will therefore participate in any flushes that occur during the transaction as well.
| Modifier and Type | Class and Description |
|---|---|
class |
RuleServiceImpl.ExecutedRuleData
Helper class to contain the information about a rule that is executed
|
Policy.ArgQNAMEQNAMEQNAMEQNAME| Constructor and Description |
|---|
RuleServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionableNodeRef,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
Rule rule)
Add a rule to the pending execution list
|
void |
addRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionableNodeRef,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
Rule rule,
boolean executeAtEnd)
Add a rule to the pending execution list
|
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.
|
void |
executePendingRules()
Execute all pending rules
|
void |
executeRule(Rule rule,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
java.util.Set executedRules)
Execute a rule
|
java.util.List |
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 ruleNodeRef)
Create the rule object from the rule node reference
|
java.util.List |
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 |
getRules(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean includeInherited)
Get the rules associated with an actionable node.
|
java.util.List |
getRules(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean includeInherited,
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 |
getRuleTypes()
Get the rule types currently defined in the repository.
|
org.alfresco.service.cmr.repository.ChildAssociationRef |
getSavedRuleFolderAssoc(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Gets the saved rule folder reference
|
protected org.alfresco.service.cmr.repository.NodeRef |
getSavedRuleFolderRef(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
boolean |
hasRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Indicates whether the node in question has any rules associated with it.
|
void |
init()
Registers to listen for events of interest.
|
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 |
onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName aspectTypeQName)
Cache invalidation
|
void |
onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
boolean isNewNode)
Cache invalidation
|
void |
onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
Cache invalidation
|
void |
onUpdateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Cache invalidation
|
void |
registerRuleType(RuleType ruleType)
Register the rule type
|
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
|
void |
removeRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Remove all pending rules that are actioning upon the given node reference
|
boolean |
rulesEnabled(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Indicates wether 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 |
setActionService(ActionService actionService)
Set the action service
|
void |
setCopyService(CopyService copyService)
Set the service for locating copied nodes' originals
|
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Set the dictionary service
|
void |
setNodeRulesCache(org.alfresco.repo.cache.SimpleCache nodeRulesCache)
Set the cache to hold node's individual rules.
|
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the permission-safe node service
|
void |
setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
Set the permission service
|
void |
setPolicyComponent(PolicyComponent policyComponent)
Set the policy component to listen for various events
|
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) |
void |
setRulesDisabled(boolean rulesDisabled)
Set the global rules disabled flag
|
void |
setRuntimeActionService(RuntimeActionService runtimeActionService)
Set the runtime action service
|
void |
setRuntimeNodeService(org.alfresco.service.cmr.repository.NodeService runtimeNodeService)
Set the direct node service
|
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setRuntimeNodeService(org.alfresco.service.cmr.repository.NodeService runtimeNodeService)
public void setCopyService(CopyService copyService)
public void setActionService(ActionService actionService)
public void setRuntimeActionService(RuntimeActionService runtimeActionService)
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
public void setPolicyComponent(PolicyComponent policyComponent)
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
public void setNodeRulesCache(org.alfresco.repo.cache.SimpleCache nodeRulesCache)
nodeRulesCache - a cache of raw rules contained on a nodeNullCachepublic void setRulesDisabled(boolean rulesDisabled)
rulesDisabled - true to disable allr ules, false otherwisepublic void init()
public void onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
boolean isNewNode)
onCreateChildAssociation in interface NodeServicePolicies.OnCreateChildAssociationPolicychildAssocRef - the child association that has been createdisNewNode - true if the node is new or false if the node is being linked inpublic void onUpdateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
onUpdateNode in interface NodeServicePolicies.OnUpdateNodePolicynodeRef - reference to the updated nodepublic void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
onCreateNode in interface NodeServicePolicies.OnCreateNodePolicychildAssocRef - the created child association referencepublic void onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName aspectTypeQName)
onAddAspect in interface NodeServicePolicies.OnAddAspectPolicynodeRef - the node to which the aspect was addedaspectTypeQName - the type of the aspectprotected org.alfresco.service.cmr.repository.NodeRef getSavedRuleFolderRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
public org.alfresco.service.cmr.repository.ChildAssociationRef getSavedRuleFolderAssoc(org.alfresco.service.cmr.repository.NodeRef nodeRef)
getSavedRuleFolderAssoc in interface RuntimeRuleServicenodeRef - the node referencepublic java.util.List getRuleTypes()
RuleServicegetRuleTypes in interface RuleServicepublic RuleType getRuleType(java.lang.String name)
RuleServicegetRuleType in interface RuleServicename - the name of the rule typepublic void enableRules()
RuleServiceenableRules in interface RuleServiceRuleService.isEnabled(),
RuleService.disableRules()public void disableRules()
RuleServicedisableRules in interface RuleServiceRuleService.enableRules(),
RuleService.isEnabled()public boolean isEnabled()
RuleServiceisEnabled in interface RuleServiceRuleService.enableRules(),
RuleService.disableRules()public boolean rulesEnabled(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicerulesEnabled in interface RuleServicenodeRef - the node referencepublic void disableRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicedisableRules in interface RuleServicenodeRef - the node referencepublic void enableRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServiceenableRules in interface RuleServicenodeRef - the node referencepublic void disableRule(Rule rule)
RuleServicedisableRule in interface RuleServicerule - the rule to disablepublic void enableRule(Rule rule)
RuleServiceenableRule in interface RuleServicerule - the rule to enablepublic void disableRuleType(java.lang.String ruleType)
RuleServicedisableRuleType in interface RuleServiceruleType - rule typepublic void enableRuleType(java.lang.String ruleType)
RuleServiceenableRuleType in interface RuleServiceruleType - rule typepublic boolean isRuleTypeEnabled(java.lang.String ruleType)
RuleServiceisRuleTypeEnabled in interface RuleServiceruleType - rule typepublic boolean hasRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicehasRules in interface RuleServicenodeRef - the node referencepublic java.util.List getRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServiceAn exception is raised if the actionable aspect is not present on the passed node.
getRules in interface RuleServicenodeRef - the node referencepublic java.util.List getRules(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean includeInherited)
RuleServiceOptionally this list includes rules inherited from its parents.
An exception is raised if the actionable aspect is not present on the passed node.
getRules in interface RuleServicenodeRef - the node referenceincludeInherited - indicates whether the inherited rules should be included in
the result list or notpublic java.util.List getRules(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean includeInherited,
java.lang.String ruleTypeName)
RuleServicegetRules in interface RuleServicenodeRef - the node referenceincludeInherited - 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 returnedpublic int countRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicecountRules in interface RuleServicenodeRef - the node referencepublic Rule getRule(org.alfresco.service.cmr.repository.NodeRef ruleNodeRef)
getRule in interface RuleServiceruleNodeRef - the rule node referencepublic void saveRule(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Rule rule)
RuleServiceIf the rule is already associated with the node, the details are updated with those specified.
saveRule in interface RuleServicepublic void saveRule(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Rule rule,
int index)
saveRule in interface RuleServicepublic void setRulePosition(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.cmr.repository.NodeRef ruleNodeRef,
int index)
setRulePosition in interface RuleServicepublic void setRulePosition(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Rule rule,
int index)
setRulePosition in interface RuleServicepublic void removeRule(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Rule rule)
RuleServiceremoveRule in interface RuleServicenodeRef - the actionable node referencepublic void removeAllRules(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServiceremoveAllRules in interface RuleServicenodeRef - the actionable node referencepublic void addRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionableNodeRef,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
Rule rule)
RuntimeRuleServiceaddRulePendingExecution in interface RuntimeRuleServiceactionableNodeRef - actionable node referenceactionedUponNodeRef - actioned upon node referencerule - rulepublic void removeRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
RuntimeRuleServiceremoveRulePendingExecution in interface RuntimeRuleServiceactionedUponNodeRef - actioned upon node referencepublic void addRulePendingExecution(org.alfresco.service.cmr.repository.NodeRef actionableNodeRef,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
Rule rule,
boolean executeAtEnd)
RuntimeRuleServiceaddRulePendingExecution in interface RuntimeRuleServiceactionableNodeRef - actionable node referenceactionedUponNodeRef - actioned upon node referencerule - ruleexecuteAtEnd - true if execute rule at the end of the transaction, false otherwisepublic void executePendingRules()
RuntimeRuleServiceexecutePendingRules in interface RuntimeRuleServicepublic void executeRule(Rule rule, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, java.util.Set executedRules)
RuntimeRuleServiceexecuteRule in interface RuntimeRuleServicerule - ruleactionedUponNodeRef - actioned upon node referenceexecutedRules - already executed rulespublic void registerRuleType(RuleType ruleType)
registerRuleType in interface RuntimeRuleServiceruleTypeAdapter - the rule type adapterpublic org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef(Rule rule)
RuleServicegetOwningNodeRef in interface RuleServicerule - the rulepublic org.alfresco.service.cmr.repository.NodeRef getOwningNodeRef(Action action)
RuleServicegetOwningNodeRef in interface RuleServiceaction - the actionpublic boolean isLinkedToRuleNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServiceisLinkedToRuleNode in interface RuleServicenodeRef - rule node referencepublic org.alfresco.service.cmr.repository.NodeRef getLinkedToRuleNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicegetLinkedToRuleNode in interface RuleServicenodeRef - node reference of a rule nodepublic java.util.List getLinkedFromRuleNodes(org.alfresco.service.cmr.repository.NodeRef nodeRef)
RuleServicegetLinkedFromRuleNodes in interface RuleServicenodeRef - node reference of a rule nodeCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.