use of org.alfresco.service.cmr.action.ActionDefinition in project acs-community-packaging by Alfresco.
the class EditRuleWizard method populateActions.
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);
}
}
use of org.alfresco.service.cmr.action.ActionDefinition in project alfresco-remote-api by Alfresco.
the class NodesImpl method extractMetadata.
/**
* Extracts the given node metadata asynchronously.
*
* The overwrite policy controls which if any parts of the document's properties are updated from this.
*/
private void extractMetadata(NodeRef nodeRef) {
final String actionName = ContentMetadataExtracter.EXECUTOR_NAME;
ActionDefinition actionDef = actionService.getActionDefinition(actionName);
if (actionDef != null) {
Action action = actionService.createAction(actionName);
actionService.executeAction(action, nodeRef);
}
}
use of org.alfresco.service.cmr.action.ActionDefinition in project records-management by Alfresco.
the class RmActionDefinitionsGet method executeImpl.
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
List<RecordsManagementAction> actions = recordsManagementActionService.getRecordsManagementActions();
Set<ActionDefinition> defs = new HashSet<ActionDefinition>(actions.size());
for (RecordsManagementAction action : actions) {
if (action.isPublicAction()) {
defs.add(action.getRecordsManagementActionDefinition());
}
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("actiondefinitions", defs);
return model;
}
use of org.alfresco.service.cmr.action.ActionDefinition in project records-management by Alfresco.
the class ExtendedActionServiceTest method inheritsAllParameterDefinitions.
/**
* Checks if the action definition rmAction inherits all the parameter definitions from delegateAction.
* @param rmAction The name of the action definition extending DelegateAction.
* @param delegateAction The name of the delegate action.
* @return true if rmAction inherits all the parameter definitions from delegateAction. false otherwise.
*/
private boolean inheritsAllParameterDefinitions(String rmAction, String delegateAction) {
/*
* Get the parameter definition list for rmAction
*/
ActionDefinition rmActionDefinition = actionService.getActionDefinition(rmAction);
assertNotNull(rmActionDefinition);
List<ParameterDefinition> rmParameterDefinitions = rmActionDefinition.getParameterDefinitions();
/*
* Get the parameter definition list for the delegate action
*/
ActionDefinition delegateActionDefinition = actionService.getActionDefinition(delegateAction);
assertNotNull(delegateActionDefinition);
List<ParameterDefinition> delegateParameterDefinitions = delegateActionDefinition.getParameterDefinitions();
/*
* Check if rmActionDefinition contains all the elements in rmActionDefinition
*/
return rmParameterDefinitions.containsAll(delegateParameterDefinitions);
}
Aggregations