Search in sources :

Example 6 with WorkflowRemovalStatus

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);
}
Also used : WorkflowRemovalStatus(com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus)

Example 7 with WorkflowRemovalStatus

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());
    }
}
Also used : WorkflowRemovalStatus(com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

WorkflowRemovalStatus (com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus)7 IOException (java.io.IOException)2 ServletException (javax.servlet.ServletException)2 WorkflowRemovalException (com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalException)1