Search in sources :

Example 6 with ActionDefinition

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);
    }
}
Also used : Action(org.alfresco.service.cmr.action.Action) CompositeAction(org.alfresco.service.cmr.action.CompositeAction) Serializable(java.io.Serializable) IHandler(org.alfresco.web.bean.actions.IHandler) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition)

Example 7 with ActionDefinition

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);
    }
}
Also used : Action(org.alfresco.service.cmr.action.Action) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition)

Example 8 with ActionDefinition

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;
}
Also used : RecordsManagementAction(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) HashMap(java.util.HashMap) ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition) HashSet(java.util.HashSet)

Example 9 with ActionDefinition

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);
}
Also used : ActionDefinition(org.alfresco.service.cmr.action.ActionDefinition) ParameterDefinition(org.alfresco.service.cmr.action.ParameterDefinition)

Aggregations

ActionDefinition (org.alfresco.service.cmr.action.ActionDefinition)9 Serializable (java.io.Serializable)2 HashMap (java.util.HashMap)2 SelectItem (javax.faces.model.SelectItem)2 Action (org.alfresco.service.cmr.action.Action)2 QuickSort (org.alfresco.web.data.QuickSort)2 HashSet (java.util.HashSet)1 FacesContext (javax.faces.context.FacesContext)1 RecordsManagementAction (org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)1 RecordsManagementActionDefinition (org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition)1 FilePlanComponentKind (org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind)1 CompositeAction (org.alfresco.service.cmr.action.CompositeAction)1 ParameterDefinition (org.alfresco.service.cmr.action.ParameterDefinition)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 IHandler (org.alfresco.web.bean.actions.IHandler)1