use of org.alfresco.service.cmr.action.ActionDefinition in project acs-community-packaging by Alfresco.
the class RunActionWizard method getActions.
@Override
public List<SelectItem> getActions() {
if (this.actions == null) {
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.parameters.get("id"));
List<ActionDefinition> ruleActions = this.getActionService().getActionDefinitions(nodeRef);
this.actions = new ArrayList<SelectItem>();
for (ActionDefinition ruleActionDef : ruleActions) {
String title = ruleActionDef.getTitle();
if (title == null || title.length() == 0) {
title = ruleActionDef.getName();
}
this.actions.add(new SelectItem(ruleActionDef.getName(), title));
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.actions, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
// add the select an action item at the start of the list
this.actions.add(0, new SelectItem("null", Application.getMessage(FacesContext.getCurrentInstance(), "select_an_action")));
}
return this.actions;
}
use of org.alfresco.service.cmr.action.ActionDefinition in project records-management by Alfresco.
the class RMActionExecuterAbstractBase method getActionDefinition.
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#getActionDefinition()
*/
@Override
public ActionDefinition getActionDefinition() {
ActionDefinition actionDefinition = super.getActionDefinition();
((RecordsManagementActionDefinitionImpl) this.actionDefinition).setApplicableKinds(applicableKinds);
return actionDefinition;
}
use of org.alfresco.service.cmr.action.ActionDefinition in project records-management by Alfresco.
the class ExtendedActionServiceImpl method getActionDefinitions.
/**
* @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public List<ActionDefinition> getActionDefinitions(NodeRef nodeRef) {
List<ActionDefinition> result = null;
// first use the base implementation to get the list of action definitions
List<ActionDefinition> actionDefinitions = super.getActionDefinitions(nodeRef);
if (nodeRef == null) {
// nothing to filter
result = actionDefinitions;
} else {
// get the file component kind of the node reference
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
result = new ArrayList<ActionDefinition>(actionDefinitions.size());
// check each action definition
for (ActionDefinition actionDefinition : actionDefinitions) {
if (actionDefinition instanceof RecordsManagementActionDefinition) {
if (kind != null) {
Set<FilePlanComponentKind> applicableKinds = ((RecordsManagementActionDefinition) actionDefinition).getApplicableKinds();
if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind)) {
// an RM action can only act on a RM artifact
result.add(actionDefinition);
}
}
} else {
if (kind == null) {
// a non-RM action can only act on a non-RM artifact
result.add(actionDefinition);
}
}
}
}
return result;
}
use of org.alfresco.service.cmr.action.ActionDefinition in project acs-community-packaging by Alfresco.
the class BaseActionWizard method getActions.
/**
* @return Returns the list of selectable actions
*/
public List<SelectItem> getActions() {
if (this.actions == null) {
List<ActionDefinition> ruleActions = this.getActionService().getActionDefinitions();
this.actions = new ArrayList<SelectItem>();
for (ActionDefinition ruleActionDef : ruleActions) {
String title = ruleActionDef.getTitle();
if (title == null || title.length() == 0) {
title = ruleActionDef.getName();
}
this.actions.add(new SelectItem(ruleActionDef.getName(), title));
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.actions, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
// add the select an action item at the start of the list
this.actions.add(0, new SelectItem("null", Application.getMessage(FacesContext.getCurrentInstance(), "select_an_action")));
}
return this.actions;
}
use of org.alfresco.service.cmr.action.ActionDefinition in project acs-community-packaging by Alfresco.
the class BaseActionWizard method promptForActionValues.
// ------------------------------------------------------------------------------
// Action event handlers
/**
* Displays the settings page for the current action being added
*/
public void promptForActionValues() {
// set the flag to show we are creating a new action
this.editingAction = false;
FacesContext context = FacesContext.getCurrentInstance();
this.returnViewId = context.getViewRoot().getViewId();
String viewId = null;
HashMap<String, Serializable> actionProps = new HashMap<String, Serializable>(3);
actionProps.put(PROP_ACTION_NAME, this.action);
this.currentActionProperties = actionProps;
this.currentEmailRecipientsDataModel = null;
// get the handler for the action, if there isn't one we presume it
// is a no-parameter action
IHandler handler = this.actionHandlers.get(this.action);
if (handler != null && !handler.isAllowMultiple() && isActionPresent(this.action)) {
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(), ERROR_ACTION_CANNOT_BE_EXECUTE_REPEATEDLY));
return;
}
if (handler != null) {
// setup any UI defaults the action may have and get the location of
// the JSP used to collect the parameters
handler.setupUIDefaults(actionProps);
viewId = handler.getJSPPath();
} else {
// just add the action to the list and use the title as the summary
ActionDefinition actionDef = this.getActionService().getActionDefinition(this.action);
actionProps.put(PROP_ACTION_SUMMARY, actionDef.getTitle());
// add the no params marker so we can disable the edit action
actionProps.put(NO_PARAMS_MARKER, "no-params");
this.allActionsProperties.add(actionProps);
// come back to the same page we're on now as there are no params to collect
viewId = this.returnViewId;
}
if (logger.isDebugEnabled())
logger.debug("Added '" + this.action + "' action to list");
// go to the page to collect the settings
goToPage(context, viewId);
}
Aggregations