org.alfresco.repo.action
Class ActionServiceImpl

java.lang.Object
  extended by org.alfresco.repo.action.ActionServiceImpl
All Implemented Interfaces:
RuntimeActionService, CopyServicePolicies.OnCopyCompletePolicy, CopyServicePolicies.OnCopyNodePolicy, ClassPolicy, Policy, ActionService, org.springframework.context.ApplicationContextAware

public class ActionServiceImpl
extends java.lang.Object
implements ActionService, RuntimeActionService, org.springframework.context.ApplicationContextAware, CopyServicePolicies.OnCopyNodePolicy, CopyServicePolicies.OnCopyCompletePolicy

Action service implementation


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
 
Field Summary
 
Fields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAME
 
Fields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy
QNAME
 
Fields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE
 
Constructor Summary
ActionServiceImpl()
           
 
Method Summary
 Action createAction(org.alfresco.service.cmr.repository.NodeRef actionNodeRef)
          Create an action from the action node reference
 Action createAction(java.lang.String name)
          Create a new action
 Action createAction(java.lang.String name, java.util.Map params)
          Create a new action specifying the initial set of parameter values
 ActionCondition createActionCondition(java.lang.String name)
          Create an action condition
 ActionCondition createActionCondition(java.lang.String name, java.util.Map params)
          Create an action condition specifying the initial set of parameter values
 org.alfresco.service.cmr.repository.NodeRef createActionNodeRef(Action action, org.alfresco.service.cmr.repository.NodeRef parentNodeRef, org.alfresco.service.namespace.QName assocTypeName, org.alfresco.service.namespace.QName assocName)
          Create a action node reference
 CompositeAction createCompositeAction()
          Create a composite action
 CompositeActionCondition createCompositeActionCondition()
          Create a composite actionCondition
 void directActionExecution(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
          Execute an action directly
 boolean evaluateAction(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
          Evaluted the conditions set on an action.
 boolean evaluateActionCondition(ActionCondition condition, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
          Evaluates the actions by finding corresponding actionEvaluators in applicationContext (registered through Spring).
 void executeAction(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
          The actions conditions are always checked.
 void executeAction(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, boolean checkConditions)
          The action is executed based on the asynchronous attribute of the action.
 void executeAction(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsychronously)
          Executes the specified action upon the node reference provided.
 void executeActionImpl(Action action, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, boolean checkConditions, boolean executedAsynchronously, java.util.Set actionChain)
          Perform low-level action execution
 Action getAction(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String actionId)
          Gets an action stored against a given node reference.
 ActionConditionDefinition getActionConditionDefinition(java.lang.String name)
          Get a named action condition definition
 java.util.List getActionConditionDefinitions()
          Get all the action condition definitions
 ActionDefinition getActionDefinition(java.lang.String name)
          Get a named action definition
 java.util.List getActionDefinitions()
          Get all the action definitions
 java.util.List getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Get all the action definitions that are applicable for the given node, based on its type and aspects.
 java.util.List getActions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Gets all the actions currently saved on the given node reference.
 CopyBehaviourCallback getCopyCallback(org.alfresco.service.namespace.QName classRef, CopyDetails copyDetails)
          Called for all types and aspects before copying a node.
 ParameterConstraint getParameterConstraint(java.lang.String name)
          Get a named parameter constraint
 java.util.List getParameterConstraints()
          Get all the parameter constraints
 void init()
           
 void onCopyComplete(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef, boolean copyToNewNode, java.util.Map copyMap)
          Ensures that d:noderef properties are repointed if the target was also copied as part of the hierarchy.
 void populateCompositeAction(org.alfresco.service.cmr.repository.NodeRef compositeNodeRef, CompositeAction compositeAction)
          Populates a composite action from a composite action node reference
 void postCommit()
          called by transaction service.
 void registerActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator)
          Register an action condition evaluator
 void registerActionExecuter(ActionExecuter actionExecuter)
          Register an action executer
 void registerParameterConstraint(ParameterConstraint parameterConstraint)
          Register parameter constraint
 void removeAction(org.alfresco.service.cmr.repository.NodeRef nodeRef, Action action)
          Removes an action associated with a node reference.
 void removeAllActions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Removes all actions associated with a node reference
 void saveAction(org.alfresco.service.cmr.repository.NodeRef nodeRef, Action action)
          Save an action against a node reference.
 void saveActionImpl(org.alfresco.service.cmr.repository.NodeRef actionNodeRef, Action action)
          Save action, used internally to store the details of an action on the aciton node.
 void setActionTrackingService(ActionTrackingService actionTrackingService)
          Set the action tracking service
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
          Set the application context
 void setAsynchronousActionExecutionQueues(java.util.Map asynchronousActionExecutionQueues)
          Set the asynchronous action execution queues
 void setAuthenticationContext(AuthenticationContext authenticationContext)
          Set the authentication component
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
          Set the dictionary service
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
          Set the node service
 void setPolicyComponent(PolicyComponent policyComponent)
           
 void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
          Set the search service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionServiceImpl

public ActionServiceImpl()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Set the application context

Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Parameters:
applicationContext - the application context
Throws:
org.springframework.beans.BeansException

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service

Parameters:
nodeService - the node service

setSearchService

public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
Set the search service

Parameters:
searchService - the search service

setAuthenticationContext

public void setAuthenticationContext(AuthenticationContext authenticationContext)
Set the authentication component

Parameters:
authenticationContext - the authentication component

setActionTrackingService

public void setActionTrackingService(ActionTrackingService actionTrackingService)
Set the action tracking service

Parameters:
actionTrackingService - the action tracking service

setDictionaryService

public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Set the dictionary service

Parameters:
dictionaryService - the dictionary service

setPolicyComponent

public void setPolicyComponent(PolicyComponent policyComponent)
Parameters:
policyComponent - used to set up the action-based policy behaviour

setAsynchronousActionExecutionQueues

public void setAsynchronousActionExecutionQueues(java.util.Map asynchronousActionExecutionQueues)
Set the asynchronous action execution queues

Parameters:
asynchronousActionExecutionQueue - the asynchronous action execution queues

init

public void init()

getActionDefinition

public ActionDefinition getActionDefinition(java.lang.String name)
Description copied from interface: ActionService
Get a named action definition

Specified by:
getActionDefinition in interface ActionService
Parameters:
name - the name of the action definition
Returns:
the action definition
See Also:
ActionService.getActionDefinition(java.lang.String)

getActionDefinitions

public java.util.List getActionDefinitions()
Description copied from interface: ActionService
Get all the action definitions

Specified by:
getActionDefinitions in interface ActionService
Returns:
the list action definitions
See Also:
ActionService.getActionDefinitions()

getActionDefinitions

public java.util.List getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: ActionService
Get all the action definitions that are applicable for the given node, based on its type and aspects.

Specified by:
getActionDefinitions in interface ActionService
Parameters:
nodeRef - the node reference
Returns:
a list of applicable action definitions
See Also:
ActionService.getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef)

getActionConditionDefinition

public ActionConditionDefinition getActionConditionDefinition(java.lang.String name)
Description copied from interface: ActionService
Get a named action condition definition

Specified by:
getActionConditionDefinition in interface ActionService
Parameters:
name - the name of the action condition definition
Returns:
the action condition definition
See Also:
ActionService.getActionConditionDefinition(java.lang.String)

getActionConditionDefinitions

public java.util.List getActionConditionDefinitions()
Description copied from interface: ActionService
Get all the action condition definitions

Specified by:
getActionConditionDefinitions in interface ActionService
Returns:
the list of action condition definitions
See Also:
ActionService.getActionConditionDefinitions()

getParameterConstraint

public ParameterConstraint getParameterConstraint(java.lang.String name)
Description copied from interface: ActionService
Get a named parameter constraint

Specified by:
getParameterConstraint in interface ActionService
Parameters:
name - the name of the parameter constraint
Returns:
this parameter condition
See Also:
ActionService.getParameterConstraint(java.lang.String)

getParameterConstraints

public java.util.List getParameterConstraints()
Description copied from interface: ActionService
Get all the parameter constraints

Specified by:
getParameterConstraints in interface ActionService
Returns:
the list of all parameter constraints
See Also:
ActionService.getParameterConstraints()

createActionCondition

public ActionCondition createActionCondition(java.lang.String name)
Description copied from interface: ActionService
Create an action condition

Specified by:
createActionCondition in interface ActionService
Parameters:
name - the action condition definition name
Returns:
the action condition
See Also:
ActionService.createActionCondition(java.lang.String)

createActionCondition

public ActionCondition createActionCondition(java.lang.String name,
                                             java.util.Map params)
Description copied from interface: ActionService
Create an action condition specifying the initial set of parameter values

Specified by:
createActionCondition in interface ActionService
Parameters:
name - the action condition definition name
params - the parameter values
Returns:
the action condition
See Also:
ActionService.createActionCondition(java.lang.String, java.util.Map)

createAction

public Action createAction(java.lang.String name)
Description copied from interface: ActionService
Create a new action

Specified by:
createAction in interface ActionService
Parameters:
name - the action definition name
Returns:
the action
See Also:
org.alfresco.service.cmr.action.ActionService#createAction()

createAction

public Action createAction(java.lang.String name,
                           java.util.Map params)
Description copied from interface: ActionService
Create a new action specifying the initial set of parameter values

Specified by:
createAction in interface ActionService
Parameters:
name - the action definition name
params - the parameter values
Returns:
the action
See Also:
ActionService.createAction(java.lang.String, java.util.Map)

createCompositeAction

public CompositeAction createCompositeAction()
Description copied from interface: ActionService
Create a composite action

Specified by:
createCompositeAction in interface ActionService
Returns:
the composite action
See Also:
ActionService.createCompositeAction()

createCompositeActionCondition

public CompositeActionCondition createCompositeActionCondition()
Description copied from interface: ActionService
Create a composite actionCondition

Specified by:
createCompositeActionCondition in interface ActionService
Returns:
the composite actionCondition
See Also:
ActionService.createCompositeActionCondition()

evaluateAction

public boolean evaluateAction(Action action,
                              org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Description copied from interface: ActionService
Evaluted the conditions set on an action.

Returns true if the action has no conditions.

If the action has more than one condition their results are combined using the 'AND' logical operator.

Specified by:
evaluateAction in interface ActionService
Parameters:
action - the action
actionedUponNodeRef - the actioned upon node reference
Returns:
true if the condition succeeds, false otherwise
See Also:
ActionService.evaluateAction(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)

evaluateActionCondition

public boolean evaluateActionCondition(ActionCondition condition,
                                       org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Evaluates the actions by finding corresponding actionEvaluators in applicationContext (registered through Spring). Composite conditions are evaluated here as well. It is also possible to have composite actions inside composite actions.

Specified by:
evaluateActionCondition in interface ActionService
Parameters:
condition - the action condition
actionedUponNodeRef - the actioned upon node reference
Returns:
true if the condition succeeds, false otherwise
See Also:
ActionService.evaluateActionCondition(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef)

executeAction

public void executeAction(Action action,
                          org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
                          boolean checkConditions)
Description copied from interface: ActionService
The action is executed based on the asynchronous attribute of the action.

Specified by:
executeAction in interface ActionService
Parameters:
action - the action
actionedUponNodeRef - the actioned upon node reference
checkConditions - indicates whether the conditions should be checked
See Also:
ActionService.executeAction(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef, boolean)

executeAction

public void executeAction(Action action,
                          org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
                          boolean checkConditions,
                          boolean executeAsychronously)
Description copied from interface: ActionService
Executes the specified action upon the node reference provided.

If specified that the conditions should be checked then any conditions set on the action are evaluated.

If the conditions fail then the action is not executed.

If an action has no conditions then the action will always be executed.

If the conditions are not checked then the action will always be executed.

Specified by:
executeAction in interface ActionService
Parameters:
action - the action
actionedUponNodeRef - the actioned upon node reference
checkConditions - indicates whether the conditions should be checked before executing the action
executeAsychronously - indicates whether the action should be executed asychronously or not, this value overrides the value set on the action its self
See Also:
ActionService.executeAction(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef, boolean)

postCommit

public void postCommit()
called by transaction service.

Specified by:
postCommit in interface RuntimeActionService

executeActionImpl

public void executeActionImpl(Action action,
                              org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
                              boolean checkConditions,
                              boolean executedAsynchronously,
                              java.util.Set actionChain)
Description copied from interface: RuntimeActionService
Perform low-level action execution

Specified by:
executeActionImpl in interface RuntimeActionService

directActionExecution

public void directActionExecution(Action action,
                                  org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Description copied from interface: RuntimeActionService
Execute an action directly

Specified by:
directActionExecution in interface RuntimeActionService
Parameters:
action - the action
actionedUponNodeRef - the actioned upon node reference
See Also:
RuntimeActionService.directActionExecution(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)

executeAction

public void executeAction(Action action,
                          org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Description copied from interface: ActionService
The actions conditions are always checked.

Specified by:
executeAction in interface ActionService
Parameters:
action - the action
actionedUponNodeRef - the actioned upon node reference
See Also:
ActionService.executeAction(org.alfresco.service.cmr.action.Action, NodeRef)

registerActionConditionEvaluator

public void registerActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator)
Description copied from interface: RuntimeActionService
Register an action condition evaluator

Specified by:
registerActionConditionEvaluator in interface RuntimeActionService
Parameters:
actionConditionEvaluator - action condition evaluator
See Also:
RuntimeActionService.registerActionConditionEvaluator(org.alfresco.repo.action.evaluator.ActionConditionEvaluator)

registerActionExecuter

public void registerActionExecuter(ActionExecuter actionExecuter)
Description copied from interface: RuntimeActionService
Register an action executer

Specified by:
registerActionExecuter in interface RuntimeActionService
Parameters:
actionExecuter - action executer
See Also:
RuntimeActionService.registerActionExecuter(org.alfresco.repo.action.executer.ActionExecuter)

registerParameterConstraint

public void registerParameterConstraint(ParameterConstraint parameterConstraint)
Description copied from interface: RuntimeActionService
Register parameter constraint

Specified by:
registerParameterConstraint in interface RuntimeActionService
Parameters:
parameterConstraint - parameter constraint
See Also:
RuntimeActionService.registerParameterConstraint(org.alfresco.service.cmr.action.ParameterConstraint)

saveAction

public void saveAction(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                       Action action)
Description copied from interface: ActionService
Save an action against a node reference.

The node will be made configurable if it is not already.

If the action already exists then its details will be updated.

Specified by:
saveAction in interface ActionService
Parameters:
nodeRef - the node reference
action - the action
See Also:
ActionService.saveAction(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.action.Action)

createActionNodeRef

public org.alfresco.service.cmr.repository.NodeRef createActionNodeRef(Action action,
                                                                       org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
                                                                       org.alfresco.service.namespace.QName assocTypeName,
                                                                       org.alfresco.service.namespace.QName assocName)
Description copied from interface: RuntimeActionService
Create a action node reference

Specified by:
createActionNodeRef in interface RuntimeActionService
Parameters:
action - action object
parentNodeRef - parent node reference
assocTypeName - association type name
assocName - association name
Returns:
NodeRef created node reference

saveActionImpl

public void saveActionImpl(org.alfresco.service.cmr.repository.NodeRef actionNodeRef,
                           Action action)
Description copied from interface: RuntimeActionService
Save action, used internally to store the details of an action on the aciton node.

Specified by:
saveActionImpl in interface RuntimeActionService
Parameters:
actionNodeRef - the action node reference
action - the action
See Also:
RuntimeActionService.saveActionImpl(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.action.Action)

getActions

public java.util.List getActions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: ActionService
Gets all the actions currently saved on the given node reference.

Specified by:
getActions in interface ActionService
Parameters:
nodeRef - the node reference
Returns:
the list of actions
See Also:
ActionService.getActions(org.alfresco.service.cmr.repository.NodeRef)

createAction

public Action createAction(org.alfresco.service.cmr.repository.NodeRef actionNodeRef)
Create an action from the action node reference

Specified by:
createAction in interface RuntimeActionService
Parameters:
actionNodeRef - the action node reference
Returns:
the action

populateCompositeAction

public void populateCompositeAction(org.alfresco.service.cmr.repository.NodeRef compositeNodeRef,
                                    CompositeAction compositeAction)
Populates a composite action from a composite action node reference

Parameters:
compositeNodeRef - the composite action node reference
compositeAction - the composite action

getAction

public Action getAction(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                        java.lang.String actionId)
Description copied from interface: ActionService
Gets an action stored against a given node reference.

Returns null if the action can not be found.

Specified by:
getAction in interface ActionService
Parameters:
nodeRef - the node reference
actionId - the action id
Returns:
the action
See Also:
ActionService.getAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)

removeAction

public void removeAction(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                         Action action)
Description copied from interface: ActionService
Removes an action associated with a node reference.

Specified by:
removeAction in interface ActionService
Parameters:
nodeRef - the node reference
action - the action
See Also:
ActionService.removeAction(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.action.Action)

removeAllActions

public void removeAllActions(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: ActionService
Removes all actions associated with a node reference

Specified by:
removeAllActions in interface ActionService
Parameters:
nodeRef - the node reference
See Also:
ActionService.removeAllActions(org.alfresco.service.cmr.repository.NodeRef)

getCopyCallback

public CopyBehaviourCallback getCopyCallback(org.alfresco.service.namespace.QName classRef,
                                             CopyDetails copyDetails)
Description copied from interface: CopyServicePolicies.OnCopyNodePolicy
Called for all types and aspects before copying a node.

Specified by:
getCopyCallback in interface CopyServicePolicies.OnCopyNodePolicy
Parameters:
classRef - the type or aspect qualified name
copyDetails - the details of the impending copy
Returns:
Returns AdctionParameterTypeCopyBehaviourCallback
See Also:
CopyServicePolicies

onCopyComplete

public void onCopyComplete(org.alfresco.service.namespace.QName classRef,
                           org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
                           org.alfresco.service.cmr.repository.NodeRef targetNodeRef,
                           boolean copyToNewNode,
                           java.util.Map copyMap)
Ensures that d:noderef properties are repointed if the target was also copied as part of the hierarchy.

Specified by:
onCopyComplete in interface CopyServicePolicies.OnCopyCompletePolicy
Parameters:
classRef - the type of the node that was copied
sourceNodeRef - the original node
targetNodeRef - the destination node
copyMap - a map containing all the nodes that have been created during the copy


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.