use of com.day.cq.workflow.WorkflowSession in project acs-aem-commons by Adobe-Consulting-Services.
the class InitServlet method getFormJSONObject.
/**
* Get the JSON data to populate the Workflow Removal form.
*
* @param resourceResolver
* @return
* @throws WorkflowException
* @throws JSONException
*/
private JSONObject getFormJSONObject(final ResourceResolver resourceResolver) throws WorkflowException, JSONException {
final JSONObject json = new JSONObject();
final WorkflowSession workflowSession = workflowService.getWorkflowSession(resourceResolver.adaptTo(Session.class));
final WorkflowModel[] workflowModels = workflowSession.getModels();
for (final WorkflowModel workflowModel : workflowModels) {
final JSONObject jsonWorkflow = new JSONObject();
jsonWorkflow.put("title", workflowModel.getTitle());
jsonWorkflow.put("id", workflowModel.getId());
json.accumulate("workflowModels", jsonWorkflow);
}
json.put("statuses", new JSONArray(Arrays.asList(WORKFLOW_STATUSES)));
return json;
}
Aggregations