use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class WorkflowInstanceRemoverImpl method complete.
private void complete(final ResourceResolver resourceResolver, final int checked, final int count) throws PersistenceException, InterruptedException {
this.save(resourceResolver);
WorkflowRemovalStatus removalStatus = this.status.get();
removalStatus.setRunning(false);
removalStatus.setChecked(checked);
removalStatus.setRemoved(count);
removalStatus.setCompletedAt(Calendar.getInstance());
this.status.set(removalStatus);
}
use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class ForceQuitServlet method doPost.
@Override
public final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
try {
workflowInstanceRemover.forceQuit();
if (workflowInstanceRemover.getStatus() != null) {
response.getWriter().write(workflowInstanceRemover.getStatus().getJSON().toString());
} else {
WorkflowRemovalStatus workflowStatus = new WorkflowRemovalStatus(request.getResourceResolver());
workflowStatus.setRunning(false);
response.getWriter().write(workflowStatus.getJSON().toString());
}
} catch (Exception e) {
log.error("Unable to create Workflow Removal status after Force Quit", e);
response.setStatus(SlingHttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write(e.getMessage());
}
}
Aggregations