use of org.alfresco.service.cmr.action.ExecutionSummary in project alfresco-remote-api by Alfresco.
the class RunningActionModelBuilder method buildSimpleList.
/**
* Build a model containing a list of running actions for the given
* list of Running Actions
*/
protected Map<String, Object> buildSimpleList(List<ExecutionSummary> runningActions) {
List<Map<String, Object>> models = new ArrayList<Map<String, Object>>();
for (ExecutionSummary summary : runningActions) {
Map<String, Object> ram = buildModel(summary);
if (ram != null) {
models.add(ram);
}
}
// Finish up
Map<String, Object> model = new HashMap<String, Object>();
model.put(MODEL_DATA_LIST, models);
return model;
}
use of org.alfresco.service.cmr.action.ExecutionSummary in project alfresco-remote-api by Alfresco.
the class RunningActionsGet method buildModel.
@Override
protected Map<String, Object> buildModel(RunningActionModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache) {
List<ExecutionSummary> actions = null;
// Do they want all actions, or only certain ones?
String type = req.getParameter("type");
String nodeRef = req.getParameter("nodeRef");
if (type != null) {
actions = actionTrackingService.getExecutingActions(type);
} else if (nodeRef != null) {
NodeRef actionNodeRef = new NodeRef(nodeRef);
Action action = runtimeActionService.createAction(actionNodeRef);
actions = actionTrackingService.getExecutingActions(action);
} else {
actions = actionTrackingService.getAllExecutingActions();
}
// Build the model list
return modelBuilder.buildSimpleList(actions);
}
use of org.alfresco.service.cmr.action.ExecutionSummary in project alfresco-remote-api by Alfresco.
the class RunningReplicationActionsGet method buildModel.
@Override
protected Map<String, Object> buildModel(RunningActionModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache) {
List<ExecutionSummary> actions = null;
// Do they want all replication actions, or only certain ones?
String name = req.getParameter("name");
if (name != null) {
// Try to find a replication definition with this name
ReplicationDefinition rd = replicationService.loadReplicationDefinition(name);
// Look up what's running
if (rd != null) {
actions = actionTrackingService.getExecutingActions(rd);
}
} else {
// All replication actions
actions = actionTrackingService.getExecutingActions(ReplicationDefinitionImpl.EXECUTOR_NAME);
}
// Build the model list
return modelBuilder.buildSimpleList(actions);
}
use of org.alfresco.service.cmr.action.ExecutionSummary in project alfresco-remote-api by Alfresco.
the class ReplicationModelBuilder method setStatus.
/**
* Figures out the status that's one of:
* New|Running|CancelRequested|Completed|Failed|Cancelled
* by merging data from the action tracking service.
* Will also set the start and end dates, from either the
* replication definition or action tracking data, depending
* on the status.
*/
protected void setStatus(ReplicationDefinition replicationDefinition, Map<String, Object> model) {
// Grab the running instance(s) of the action
List<ExecutionSummary> executing = actionTrackingService.getExecutingActions(replicationDefinition);
// Now get the details of that
ExecutionDetails details = getExecutionDetails(replicationDefinition, executing);
// Finally have the status set
setStatus(replicationDefinition, details, model);
}
use of org.alfresco.service.cmr.action.ExecutionSummary in project alfresco-remote-api by Alfresco.
the class RunningActionRestApiTest method tearDown.
@Override
protected void tearDown() throws Exception {
super.tearDown();
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.clearPeople();
// Zap any replication definitions we created
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for (ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
replicationService.deleteReplicationDefinition(rd);
}
AuthenticationUtil.clearCurrentSecurityContext();
// Clear out the running actions
for (ExecutionSummary es : actionTrackingService.getAllExecutingActions()) {
executingActionsCache.remove(AbstractActionWebscript.getRunningId(es));
}
txn.commit();
}
Aggregations