use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class StatusServlet method doGet.
@Override
public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
try {
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", e);
response.setStatus(SlingHttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write(e.getMessage());
}
}
use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class WorkflowInstanceRemoverImpl method internalForceQuit.
private void internalForceQuit() {
WorkflowRemovalStatus removalStatus = this.status.get();
removalStatus.setRunning(false);
removalStatus.setForceQuitAt(Calendar.getInstance());
this.status.set(removalStatus);
// Reset force quit flag
this.forceQuit.set(false);
}
use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class WorkflowInstanceRemoverImpl method start.
private void start(final ResourceResolver resourceResolver) throws PersistenceException, WorkflowRemovalException, InterruptedException {
// Ensure forceQuit does not have a left-over value when starting a new run
this.forceQuit.set(false);
boolean running = false;
WorkflowRemovalStatus localStatus = this.getStatus();
if (localStatus != null) {
running = localStatus.isRunning();
}
if (running) {
log.warn("Unable to start workflow instance removal; Workflow removal already running.");
throw new WorkflowRemovalException("Workflow removal already started by " + this.getStatus().getInitiatedBy());
} else {
this.status.set(new WorkflowRemovalStatus(resourceResolver));
log.info("Starting workflow instance removal");
}
}
use of com.adobe.acs.commons.workflow.bulk.removal.WorkflowRemovalStatus in project acs-aem-commons by Adobe-Consulting-Services.
the class WorkflowInstanceRemoverImpl method batchComplete.
private void batchComplete(final ResourceResolver resourceResolver, final int checked, final int count) throws PersistenceException, InterruptedException {
this.save(resourceResolver);
WorkflowRemovalStatus removalStatus = this.status.get();
removalStatus.setChecked(checked);
removalStatus.setRemoved(count);
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 WorkflowInstanceRemoverImpl method error.
private void error() throws PersistenceException, InterruptedException {
WorkflowRemovalStatus removalStatus = this.status.get();
removalStatus.setRunning(false);
removalStatus.setErredAt(Calendar.getInstance());
this.status.set(removalStatus);
}
Aggregations