Search in sources :

Example 1 with RecordsManagementAction

use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction in project records-management by Alfresco.

the class RecordsManagementActionServiceImplTest method getActionsImpl.

private void getActionsImpl() {
    List<RecordsManagementAction> result = this.rmActionService.getRecordsManagementActions();
    assertNotNull(result);
    Map<String, RecordsManagementAction> resultMap = new HashMap<String, RecordsManagementAction>(8);
    for (RecordsManagementAction action : result) {
        resultMap.put(action.getName(), action);
    }
    assertTrue(resultMap.containsKey(TestAction.NAME));
    assertTrue(resultMap.containsKey(TestAction2.NAME));
    result = this.rmActionService.getDispositionActions();
    resultMap = new HashMap<String, RecordsManagementAction>(8);
    for (RecordsManagementAction action : result) {
        resultMap.put(action.getName(), action);
    }
    assertTrue(resultMap.containsKey(TestAction.NAME));
    assertFalse(resultMap.containsKey(TestAction2.NAME));
    // get some specific actions and check the label
    RecordsManagementAction cutoff = this.rmActionService.getDispositionAction("cutoff");
    assertNotNull(cutoff);
    assertEquals("Cut Off", cutoff.getLabel());
    RecordsManagementAction freeze = this.rmActionService.getRecordsManagementAction("freeze");
    assertNotNull(freeze);
    assertEquals("Freeze", freeze.getLabel());
    assertEquals("Freeze", freeze.getLabel());
    // test non-existent actions
    assertNull(this.rmActionService.getDispositionAction("notThere"));
    assertNull(this.rmActionService.getRecordsManagementAction("notThere"));
}
Also used : RecordsManagementAction(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) HashMap(java.util.HashMap)

Example 2 with RecordsManagementAction

use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction in project records-management by Alfresco.

the class DispositionActionDefinitionImpl method getLabel.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLabel()
 */
@Override
public String getLabel() {
    if (label == null) {
        String name = getName();
        label = name;
        // get the disposition action from the RM action service
        RecordsManagementAction action = recordsManagementActionService.getDispositionAction(name);
        if (action != null) {
            label = action.getLabel();
        }
    }
    return label;
}
Also used : RecordsManagementAction(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)

Example 3 with RecordsManagementAction

use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction in project records-management by Alfresco.

the class DispositionActionImpl method getLabel.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getLabel()
 */
public String getLabel() {
    String name = getName();
    String label = name;
    // get the disposition action from the RM action service
    RecordsManagementAction action = services.getRecordsManagementActionService().getDispositionAction(name);
    if (action != null) {
        label = action.getLabel();
    }
    return label;
}
Also used : RecordsManagementAction(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)

Example 4 with RecordsManagementAction

use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction in project records-management by Alfresco.

the class RMActionProxyFactoryBean method registerAction.

/**
 * Register the action
 */
public void registerAction() {
    AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {

        public Void doWork() {
            transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>() {

                public Void execute() throws Throwable {
                    RecordsManagementAction action = (RecordsManagementAction) getObject();
                    recordsManagementActionService.register(action);
                    return null;
                }
            });
            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
}
Also used : RecordsManagementAction(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) AuthenticationUtil(org.alfresco.repo.security.authentication.AuthenticationUtil) RetryingTransactionCallback(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)

Example 5 with RecordsManagementAction

use of org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction 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)

Aggregations

RecordsManagementAction (org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction)7 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 AuthenticationUtil (org.alfresco.repo.security.authentication.AuthenticationUtil)1 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)1 ActionDefinition (org.alfresco.service.cmr.action.ActionDefinition)1