Package org.alfresco.repo.action
Class ActionServiceImpl
java.lang.Object
org.alfresco.repo.action.ActionServiceImpl
- All Implemented Interfaces:
RuntimeActionService,CopyServicePolicies.OnCopyCompletePolicy,CopyServicePolicies.OnCopyNodePolicy,ClassPolicy,Policy,ActionService,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class ActionServiceImpl
extends Object
implements ActionService, RuntimeActionService, org.springframework.context.ApplicationContextAware, CopyServicePolicies.OnCopyNodePolicy, CopyServicePolicies.OnCopyCompletePolicy
Action service implementation
- Author:
- Roy Wetherall
-
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.OnCopyCompletePolicy
QNAMEFields inherited from interface org.alfresco.repo.copy.CopyServicePolicies.OnCopyNodePolicy
ARG_0, ARG_1, QNAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAction(String name) Create a new actioncreateAction(String name, Map<String, Serializable> params) Create a new action specifying the initial set of parameter valuescreateAction(NodeRef actionNodeRef) Create an action from the action node referencecreateActionCondition(String name) Create an action conditioncreateActionCondition(String name, Map<String, Serializable> params) Create an action condition specifying the initial set of parameter valuescreateActionNodeRef(Action action, NodeRef parentNodeRef, QName assocTypeName, QName assocName) Create a action node referenceCreate a composite actionCreate a composite actionConditionvoiddirectActionExecution(Action action, NodeRef actionedUponNodeRef) Execute an action directlybooleanevaluateAction(Action action, NodeRef actionedUponNodeRef) Evaluted the conditions set on an action.booleanevaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef) Evaluates the actions by finding corresponding actionEvaluators in applicationContext (registered through Spring).voidexecuteAction(Action action, NodeRef actionedUponNodeRef) The actions conditions are always checked.voidexecuteAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions) The action is executed based on the asynchronous attribute of the action.voidexecuteAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsychronously) Executes the specified action upon the node reference provided.voidexecuteActionImpl(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executedAsynchronously, Set<String> actionChain) Perform low-level action executionGets an action stored against a given node reference.Get a named action condition definitionGet all the action condition definitionsgetActionDefinition(String name) Get a named action definitionGet all the action definitionsgetActionDefinitions(NodeRef nodeRef) Get all the action definitions that are applicable for the given node, based on its type and aspects.getActions(NodeRef nodeRef) Gets all the actions currently saved on the given node reference.getCopyCallback(QName classRef, CopyDetails copyDetails) Called for all types and aspects before copying a node.getParameterConstraint(String name) Get a named parameter constraintGet all the parameter constraintsvoidinit()voidonCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map<NodeRef, NodeRef> copyMap) Ensures that d:noderef properties are repointed if the target was also copied as part of the hierarchy.booleanonLogException(Action action, org.apache.commons.logging.Log logger, Throwable t, String message) Optional logging of errors callback for the action executer for the cases when the error might be ignored or shown in a different manner for the actionvoidpopulateCompositeAction(NodeRef compositeNodeRef, CompositeAction compositeAction) Populates a composite action from a composite action node referencevoidcalled by transaction service.voidregisterActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator) Register an action condition evaluatorvoidregisterActionExecuter(ActionExecuter actionExecuter) Register an action executervoidregisterAsynchronousActionExecutionQueue(String key, AsynchronousActionExecutionQueue asyncExecQueue) This method registers anAsynchronousActionExecutionQueuewith theActionService.voidregisterParameterConstraint(ParameterConstraint parameterConstraint) Register parameter constraintvoidremoveAction(NodeRef nodeRef, Action action) Removes an action associated with a node reference.voidremoveAllActions(NodeRef nodeRef) Removes all actions associated with a node referencevoidsaveAction(NodeRef nodeRef, Action action) Save an action against a node reference.voidsaveActionImpl(NodeRef actionNodeRef, Action action) Save action, used internally to store the details of an action on the aciton node.voidsetActionTrackingService(ActionTrackingService actionTrackingService) Set the action tracking servicevoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) Set the application contextvoidsetAsynchronousActionExecutionQueues(Map<String, AsynchronousActionExecutionQueue> asynchronousActionExecutionQueues) Deprecated.voidsetAuthenticationContext(AuthenticationContext authenticationContext) Set the authentication componentvoidsetDictionaryService(DictionaryService dictionaryService) Set the dictionary servicevoidsetMonitor(ActionServiceMonitor monitor) voidsetNodeService(NodeService nodeService) Set the node servicevoidsetPolicyComponent(PolicyComponent policyComponent) voidsetSearchService(SearchService searchService) Set the search servicevoidverifyActionAccessRestrictions(Action action) Verify users access to an action with restrictions
-
Constructor Details
-
ActionServiceImpl
public ActionServiceImpl()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException Set the application context- Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Parameters:
applicationContext- the application context- Throws:
org.springframework.beans.BeansException
-
setNodeService
Set the node service- Parameters:
nodeService- the node service
-
setSearchService
Set the search service- Parameters:
searchService- the search service
-
setAuthenticationContext
Set the authentication component- Parameters:
authenticationContext- the authentication component
-
setActionTrackingService
Set the action tracking service- Parameters:
actionTrackingService- the action tracking service
-
setDictionaryService
Set the dictionary service- Parameters:
dictionaryService- the dictionary service
-
setPolicyComponent
- Parameters:
policyComponent- used to set up the action-based policy behaviour
-
setMonitor
- Parameters:
monitor- used to monitor running actions and execution times
-
setAsynchronousActionExecutionQueues
public void setAsynchronousActionExecutionQueues(Map<String, AsynchronousActionExecutionQueue> asynchronousActionExecutionQueues) Deprecated.Rather than inject a map, it is preferable to inject individualAsynchronousActionExecutionQueueinstances during bean initialisation in a spring init-method.Set the asynchronous action execution queues- Parameters:
asynchronousActionExecutionQueues- the asynchronous action execution queues
-
registerAsynchronousActionExecutionQueue
public void registerAsynchronousActionExecutionQueue(String key, AsynchronousActionExecutionQueue asyncExecQueue) This method registers anAsynchronousActionExecutionQueuewith theActionService.- Parameters:
key- StringasyncExecQueue- AsynchronousActionExecutionQueue- Since:
- Thor Phase 2 Sprint 2
-
init
public void init() -
getActionDefinition
Description copied from interface:ActionServiceGet a named action definition- Specified by:
getActionDefinitionin interfaceActionService- Parameters:
name- the name of the action definition- Returns:
- the action definition
- See Also:
-
getActionDefinitions
Description copied from interface:ActionServiceGet all the action definitions- Specified by:
getActionDefinitionsin interfaceActionService- Returns:
- the list action definitions
- See Also:
-
getActionDefinitions
Description copied from interface:ActionServiceGet all the action definitions that are applicable for the given node, based on its type and aspects.- Specified by:
getActionDefinitionsin interfaceActionService- Parameters:
nodeRef- the node reference- Returns:
- a list of applicable action definitions
- See Also:
-
getActionConditionDefinition
Description copied from interface:ActionServiceGet a named action condition definition- Specified by:
getActionConditionDefinitionin interfaceActionService- Parameters:
name- the name of the action condition definition- Returns:
- the action condition definition
- See Also:
-
getActionConditionDefinitions
Description copied from interface:ActionServiceGet all the action condition definitions- Specified by:
getActionConditionDefinitionsin interfaceActionService- Returns:
- the list of action condition definitions
- See Also:
-
getParameterConstraint
Description copied from interface:ActionServiceGet a named parameter constraint- Specified by:
getParameterConstraintin interfaceActionService- Parameters:
name- the name of the parameter constraint- Returns:
- this parameter condition
- See Also:
-
getParameterConstraints
Description copied from interface:ActionServiceGet all the parameter constraints- Specified by:
getParameterConstraintsin interfaceActionService- Returns:
- the list of all parameter constraints
- See Also:
-
createActionCondition
Description copied from interface:ActionServiceCreate an action condition- Specified by:
createActionConditionin interfaceActionService- Parameters:
name- the action condition definition name- Returns:
- the action condition
- See Also:
-
createActionCondition
Description copied from interface:ActionServiceCreate an action condition specifying the initial set of parameter values- Specified by:
createActionConditionin interfaceActionService- Parameters:
name- the action condition definition nameparams- the parameter values- Returns:
- the action condition
- See Also:
-
createAction
Description copied from interface:ActionServiceCreate a new action- Specified by:
createActionin interfaceActionService- Parameters:
name- the action definition name- Returns:
- the action
- See Also:
-
createAction
Description copied from interface:ActionServiceCreate a new action specifying the initial set of parameter values- Specified by:
createActionin interfaceActionService- Parameters:
name- the action definition nameparams- the parameter values- Returns:
- the action
- See Also:
-
createCompositeAction
Description copied from interface:ActionServiceCreate a composite action- Specified by:
createCompositeActionin interfaceActionService- Returns:
- the composite action
- See Also:
-
createCompositeActionCondition
Description copied from interface:ActionServiceCreate a composite actionCondition- Specified by:
createCompositeActionConditionin interfaceActionService- Returns:
- the composite actionCondition
- See Also:
-
evaluateAction
Description copied from interface:ActionServiceEvaluted 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:
evaluateActionin interfaceActionService- Parameters:
action- the actionactionedUponNodeRef- the actioned upon node reference- Returns:
- true if the condition succeeds, false otherwise
- See Also:
-
evaluateActionCondition
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:
evaluateActionConditionin interfaceActionService- Parameters:
condition- the action conditionactionedUponNodeRef- the actioned upon node reference- Returns:
- true if the condition succeeds, false otherwise
- See Also:
-
executeAction
Description copied from interface:ActionServiceThe action is executed based on the asynchronous attribute of the action.- Specified by:
executeActionin interfaceActionService- Parameters:
action- the actionactionedUponNodeRef- the actioned upon node referencecheckConditions- indicates whether the conditions should be checked- See Also:
-
executeAction
public void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsychronously) Description copied from interface:ActionServiceExecutes 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:
executeActionin interfaceActionService- Parameters:
action- the actionactionedUponNodeRef- the actioned upon node referencecheckConditions- indicates whether the conditions should be checked before executing the actionexecuteAsychronously- indicates whether the action should be executed asychronously or not, this value overrides the value set on the action its self- See Also:
-
verifyActionAccessRestrictions
Description copied from interface:RuntimeActionServiceVerify users access to an action with restrictions- Specified by:
verifyActionAccessRestrictionsin interfaceRuntimeActionService- See Also:
-
postCommit
public void postCommit()called by transaction service.- Specified by:
postCommitin interfaceRuntimeActionService
-
executeActionImpl
public void executeActionImpl(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executedAsynchronously, Set<String> actionChain) Description copied from interface:RuntimeActionServicePerform low-level action execution- Specified by:
executeActionImplin interfaceRuntimeActionService
-
directActionExecution
Description copied from interface:RuntimeActionServiceExecute an action directly- Specified by:
directActionExecutionin interfaceRuntimeActionService- Parameters:
action- the actionactionedUponNodeRef- the actioned upon node reference- See Also:
-
executeAction
Description copied from interface:ActionServiceThe actions conditions are always checked.- Specified by:
executeActionin interfaceActionService- Parameters:
action- the actionactionedUponNodeRef- the actioned upon node reference- See Also:
-
registerActionConditionEvaluator
Description copied from interface:RuntimeActionServiceRegister an action condition evaluator- Specified by:
registerActionConditionEvaluatorin interfaceRuntimeActionService- Parameters:
actionConditionEvaluator- action condition evaluator- See Also:
-
registerActionExecuter
Description copied from interface:RuntimeActionServiceRegister an action executer- Specified by:
registerActionExecuterin interfaceRuntimeActionService- Parameters:
actionExecuter- action executer- See Also:
-
registerParameterConstraint
Description copied from interface:RuntimeActionServiceRegister parameter constraint- Specified by:
registerParameterConstraintin interfaceRuntimeActionService- Parameters:
parameterConstraint- parameter constraint- See Also:
-
saveAction
Description copied from interface:ActionServiceSave 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:
saveActionin interfaceActionService- Parameters:
nodeRef- the node referenceaction- the action- See Also:
-
createActionNodeRef
public NodeRef createActionNodeRef(Action action, NodeRef parentNodeRef, QName assocTypeName, QName assocName) Description copied from interface:RuntimeActionServiceCreate a action node reference- Specified by:
createActionNodeRefin interfaceRuntimeActionService- Parameters:
action- action objectparentNodeRef- parent node referenceassocTypeName- association type nameassocName- association name- Returns:
- NodeRef created node reference
-
saveActionImpl
Description copied from interface:RuntimeActionServiceSave action, used internally to store the details of an action on the aciton node.- Specified by:
saveActionImplin interfaceRuntimeActionService- Parameters:
actionNodeRef- the action node referenceaction- the action- See Also:
-
getActions
Description copied from interface:ActionServiceGets all the actions currently saved on the given node reference.- Specified by:
getActionsin interfaceActionService- Parameters:
nodeRef- the node reference- Returns:
- the list of actions
- See Also:
-
createAction
Create an action from the action node reference- Specified by:
createActionin interfaceRuntimeActionService- Parameters:
actionNodeRef- the action node reference- Returns:
- the action
-
populateCompositeAction
Populates a composite action from a composite action node reference- Parameters:
compositeNodeRef- the composite action node referencecompositeAction- the composite action
-
getAction
Description copied from interface:ActionServiceGets an action stored against a given node reference.Returns null if the action can not be found.
- Specified by:
getActionin interfaceActionService- Parameters:
nodeRef- the node referenceactionId- the action id- Returns:
- the action
- See Also:
-
removeAction
Description copied from interface:ActionServiceRemoves an action associated with a node reference.- Specified by:
removeActionin interfaceActionService- Parameters:
nodeRef- the node referenceaction- the action- See Also:
-
removeAllActions
Description copied from interface:ActionServiceRemoves all actions associated with a node reference- Specified by:
removeAllActionsin interfaceActionService- Parameters:
nodeRef- the node reference- See Also:
-
getCopyCallback
Description copied from interface:CopyServicePolicies.OnCopyNodePolicyCalled for all types and aspects before copying a node.- Specified by:
getCopyCallbackin interfaceCopyServicePolicies.OnCopyNodePolicy- Parameters:
classRef- the type or aspect qualified namecopyDetails- the details of the impending copy- Returns:
- Returns
CopyBehaviourCallback - See Also:
-
onCopyComplete
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map<NodeRef, NodeRef> copyMap) Ensures that d:noderef properties are repointed if the target was also copied as part of the hierarchy.- Specified by:
onCopyCompletein interfaceCopyServicePolicies.OnCopyCompletePolicy- Parameters:
classRef- the type of the node that was copiedsourceNodeRef- the original nodetargetNodeRef- the destination nodecopyMap- a map containing all the nodes that have been created during the copy
-
onLogException
public boolean onLogException(Action action, org.apache.commons.logging.Log logger, Throwable t, String message) Description copied from interface:RuntimeActionServiceOptional logging of errors callback for the action executer for the cases when the error might be ignored or shown in a different manner for the action- Specified by:
onLogExceptionin interfaceRuntimeActionService- Parameters:
action- the actionlogger- the loggert- the exception thrownmessage- the proposed message that will be logged- Returns:
- true if it was handled, false for default handling
-
AsynchronousActionExecutionQueueinstances during bean initialisation in a spring init-method.