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"));
}
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;
}
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;
}
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());
}
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;
}
Aggregations