本文整理汇总了Java中org.alfresco.service.cmr.action.CompositeAction类的典型用法代码示例。如果您正苦于以下问题:Java CompositeAction类的具体用法?Java CompositeAction怎么用?Java CompositeAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompositeAction类属于org.alfresco.service.cmr.action包,在下文中一共展示了CompositeAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadRenditionDefinition
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
public RenditionDefinition loadRenditionDefinition(QName renditionDefinitionName)
{
NodeRef actionNode = findActionNode(renditionDefinitionName);
if (actionNode != null)
{
Action action = runtimeActionService.createAction(actionNode);
if (action instanceof CompositeAction)
{
CompositeAction compAction = (CompositeAction) action;
return new CompositeRenditionDefinitionImpl(compAction);
}
else
{
return new RenditionDefinitionImpl(action);
}
}
else
return null;
}
示例2: CompositeRenditionDefinitionImpl
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
public CompositeRenditionDefinitionImpl(CompositeAction compositeAction)
{
super(compositeAction, CompositeRenderingEngine.NAME);
for (Action action : compositeAction.getActions())
{
RenditionDefinition subDefinition;
if (action instanceof CompositeAction)
{
CompositeAction compAction = (CompositeAction) action;
subDefinition = new CompositeRenditionDefinitionImpl(compAction);
}
else
{
subDefinition = new RenditionDefinitionImpl(action);
}
addAction(subDefinition);
}
}
示例3: createAction
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Create an action from the action node reference
*
* @param actionNodeRef the action node reference
* @return the action
*/
public Action createAction(NodeRef actionNodeRef)
{
Action result = null;
Map<QName, Serializable> properties = this.nodeService.getProperties(actionNodeRef);
QName actionType = this.nodeService.getType(actionNodeRef);
if (ActionModel.TYPE_COMPOSITE_ACTION.equals(actionType) == true)
{
// Create a composite action
result = new CompositeActionImpl(actionNodeRef, actionNodeRef.getId());
populateCompositeAction(actionNodeRef, (CompositeAction) result);
}
else
{
// Create an action
result = new ActionImpl(actionNodeRef, actionNodeRef.getId(), (String) properties
.get(ActionModel.PROP_DEFINITION_NAME));
populateAction(actionNodeRef, result);
}
return result;
}
示例4: getAction
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Build the composite action in the context of the given node.
* @param nodeRef NodeRef
* @return - the contextualised action.
*
*/
public Action getAction(NodeRef nodeRef)
{
CompositeAction compositeAction = getActionService().createCompositeAction();
for(TemplateActionDefinition tad : templateActionDefinitions)
{
compositeAction.addAction(tad.getAction(nodeRef));
}
if (getCompensatingTemplateCompositeActionDefinition() != null)
{
compositeAction.setCompensatingAction(getCompensatingTemplateCompositeActionDefinition().getAction(nodeRef));
}
return compositeAction;
}
示例5: createScriptAction
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
private Action createScriptAction()
{
// get script nodeRef
NodeRef storeRootNodeRef = nodeService.getRootNode(new StoreRef("workspace://SpacesStore"));
NodeRef scriptRef = searchService.selectNodes(storeRootNodeRef, "/app:company_home/app:dictionary/app:scripts/cm:nothingToDo.js", null, namespaceService, false).get(0);
assertNotNull("NodeRef script is null", scriptRef);
// create action
CompositeAction compositeAction = actionService.createCompositeAction();
// add the action to the rule
Action action = actionService.createAction("script");
Map<String, Serializable> repoActionParams = new HashMap<String, Serializable>();
repoActionParams.put("script-ref", scriptRef);
action.setParameterValues(repoActionParams);
compositeAction.addAction(action);
return compositeAction;
}
示例6: populateCompositeAction
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Populates a composite action from a composite action node reference
*
* @param compositeNodeRef the composite action node reference
* @param compositeAction the composite action
*/
public void populateCompositeAction(NodeRef compositeNodeRef, CompositeAction compositeAction)
{
populateAction(compositeNodeRef, compositeAction);
List<ChildAssociationRef> actions = this.nodeService.getChildAssocs(compositeNodeRef,
RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_ACTIONS);
for (ChildAssociationRef action : actions)
{
NodeRef actionNodeRef = action.getChildRef();
compositeAction.addAction(createAction(actionNodeRef));
}
}
示例7: executeImpl
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef)
*/
public void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (action instanceof CompositeAction)
{
for (Action subAction : ((CompositeAction)action).getActions())
{
// We don't check the conditions of sub-actions and they don't have an execution history
this.actionService.directActionExecution(subAction, actionedUponNodeRef);
}
}
}
示例8: testCreateCompositeAction
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Test createCompositeAction
*/
public void testCreateCompositeAction()
{
CompositeAction action = this.actionService.createCompositeAction();
assertNotNull(action);
assertEquals(CompositeActionExecuter.NAME, action.getActionDefinitionName());
}
示例9: testActionOrder
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
public void testActionOrder()
{
CompositeAction action = this.actionService.createCompositeAction();
String actionId = action.getId();
Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action.addAction(action1);
action.addAction(action2);
this.actionService.saveAction(this.nodeRef, action);
CompositeAction savedAction = (CompositeAction)this.actionService.getAction(this.nodeRef, actionId);
// Check that the conditions have been retrieved in the correct order
assertNotNull(savedAction);
assertEquals(action1, savedAction.getAction(0));
assertEquals(action2, savedAction.getAction(1));
Action action3 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
Action action4 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
// Update the conditions on the action
savedAction.removeAction(action1);
savedAction.addAction(action3);
savedAction.addAction(action4);
this.actionService.saveAction(this.nodeRef, savedAction);
CompositeAction savedAction2 = (CompositeAction)this.actionService.getAction(this.nodeRef, actionId);
// Check that the conditions are still in the correct order
assertNotNull(savedAction2);
assertEquals(action2, savedAction2.getAction(0));
assertEquals(action3, savedAction2.getAction(1));
assertEquals(action4, savedAction2.getAction(2));
}
示例10: testAsyncCompositeActionExecute
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Test async composite action execution
*/
public void testAsyncCompositeActionExecute()
{
// Create the composite action
Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
CompositeAction compAction = this.actionService.createCompositeAction();
compAction.setTitle("title");
compAction.setDescription("description");
compAction.addAction(action1);
compAction.addAction(action2);
compAction.setExecuteAsynchronously(true);
// Execute the composite action
this.actionService.executeAction(compAction, this.nodeRef);
setComplete();
endTransaction();
final NodeService finalNodeService = this.nodeService;
final NodeRef finalNodeRef = this.nodeRef;
postAsyncActionTest(
this.transactionService,
1000,
10,
new AsyncTest()
{
public String executeTest()
{
boolean result = finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE);
return result ? null : "Expected aspects Versionable & Lockable";
};
});
}
示例11: executeImpl
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef)
*/
public void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (action instanceof CompositeAction)
{
for (Action subAction : ((CompositeAction)action).getActions())
{
// We don't check the conditions of sub-actions and they don't have an execution history
this.actionService.directActionExecution(subAction, actionedUponNodeRef);
}
}
}
示例12: testAsyncCompositeActionExecute
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
/**
* Test async composite action execution
*/
public void testAsyncCompositeActionExecute()
{
// Create the composite action
Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE);
Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME);
action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_VERSIONABLE);
CompositeAction compAction = this.actionService.createCompositeAction();
compAction.setTitle("title");
compAction.setDescription("description");
compAction.addAction(action1);
compAction.addAction(action2);
compAction.setExecuteAsynchronously(true);
// Execute the composite action
this.actionService.executeAction(compAction, this.nodeRef);
setComplete();
endTransaction();
final NodeService finalNodeService = this.nodeService;
final NodeRef finalNodeRef = this.nodeRef;
postAsyncActionTest(
this.transactionService,
1000,
10,
new AsyncTest()
{
public String executeTest()
{
boolean result = finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_VERSIONABLE) &&
finalNodeService.hasAspect(finalNodeRef, ContentModel.ASPECT_LOCKABLE);
return result ? null : "Expected aspects Versionable & Lockable";
};
});
}
示例13: init
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
// get hold of the current rule details
Rule rule = this.rulesDialog.getCurrentRule();
if (rule == null)
{
throw new AlfrescoRuntimeException("Failed to locate the current rule");
}
// populate the bean with current values
this.type = rule.getRuleTypes().get(0);
this.title = rule.getTitle();
this.description = rule.getDescription();
this.applyToSubSpaces = rule.isAppliedToChildren();
this.runInBackground = rule.getExecuteAsynchronously();
this.ruleDisabled = rule.getRuleDisabled();
FacesContext context = FacesContext.getCurrentInstance();
// Get the composite action
CompositeAction compositeAction = getCompositeAction(rule);
populateConditions(context, compositeAction);
populateActions(context, compositeAction);
// reset the current condition
this.selectedCondition = null;
// reset the current action
this.action = null;
}
示例14: populateActions
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
protected void populateActions(FacesContext context, CompositeAction compositeAction)
{
// populate the actions list with maps of properties representing each action
List<Action> actions = compositeAction.getActions();
for (Action action : actions)
{
this.currentActionProperties = new HashMap<String, Serializable>(3);
this.currentEmailRecipientsDataModel = null;
this.action = action.getActionDefinitionName();
this.currentActionProperties.put(PROP_ACTION_NAME, this.action);
IHandler handler = this.actionHandlers.get(this.action);
if (handler != null)
{
// use the handler to populate the properties and summary
handler.prepareForEdit(this.currentActionProperties, action.getParameterValues());
this.currentActionProperties.put(PROP_ACTION_SUMMARY, handler.generateSummary(context, this,
this.currentActionProperties));
}
else
{
// there's no handler, so we presume it is a no-parameter
// action, use the action title as the summary
ActionDefinition actionDef = this.getActionService().getActionDefinition(this.action);
this.currentActionProperties.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
// add the no params marker so we can disable the edit action
this.currentActionProperties.put(NO_PARAMS_MARKER, "no-params");
}
// add the populated currentActionProperties to the list
this.allActionsProperties.add(this.currentActionProperties);
}
}
示例15: finishImpl
import org.alfresco.service.cmr.action.CompositeAction; //导入依赖的package包/类
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// get hold of the space the rule will apply to and make sure
// it is actionable
Node currentSpace = browseBean.getActionSpace();
// get the existing rule
Rule rule = this.rulesDialog.getCurrentRule();
// Get the composite action
CompositeAction compositeAction = getCompositeAction(rule);
// remove all the conditions and actions from the current rule
compositeAction.removeAllActionConditions();
compositeAction.removeAllActions();
// re-setup the rule
outcome = setupRule(context, rule, outcome);
// Save the rule
this.getRuleService().saveRule(currentSpace.getNodeRef(), rule);
if (logger.isDebugEnabled())
logger.debug("Updated rule '" + this.title + "'");
return outcome;
}