Search in sources :

Example 1 with SyntheticWorkItem

use of com.adobe.acs.commons.workflow.synthetic.impl.cq.SyntheticWorkItem in project acs-aem-commons by Adobe-Consulting-Services.

the class SyntheticWorkflowRunnerImpl method runCqWorkflowProcess.

private void runCqWorkflowProcess(Session session, SyntheticWorkflow workflow, SyntheticMetaDataMap workflowProcessMetaDataMap, SyntheticWorkflowProcess workflowProcess) throws WorkflowException {
    final WorkflowSession workflowSession = this.getCqWorkflowSession(session);
    // Each Workflow Process Step gets its own workItem whose life starts and ends w the WF Process
    final SyntheticWorkItem workItem = new SyntheticWorkItem(workflow.getWorkflowData());
    workItem.setWorkflow(workflow);
    log.trace("Executing CQ synthetic workflow process [ {} ] on [ {} ]", workflowProcess.getProcessId(), workflow.getWorkflowData().getPayload());
    // Execute the Workflow Process
    try {
        workflowProcess.getCqWorkflowProcess().execute(workItem, workflowSession, workflowProcessMetaDataMap);
        workItem.setTimeEnded(new Date());
    } catch (SyntheticCompleteWorkflowException ex) {
        // Workitem force-completed via a call to workflowSession.complete(..)
        workItem.setTimeEnded(new Date());
        log.trace(ex.getMessage());
    } catch (SyntheticTerminateWorkflowException ex) {
        workItem.setTimeEnded(new Date());
        log.trace(ex.getMessage());
        throw ex;
    }
}
Also used : SyntheticWorkItem(com.adobe.acs.commons.workflow.synthetic.impl.cq.SyntheticWorkItem) SyntheticTerminateWorkflowException(com.adobe.acs.commons.workflow.synthetic.impl.cq.exceptions.SyntheticTerminateWorkflowException) SyntheticCompleteWorkflowException(com.adobe.acs.commons.workflow.synthetic.impl.cq.exceptions.SyntheticCompleteWorkflowException) SyntheticWorkflowSession(com.adobe.acs.commons.workflow.synthetic.impl.cq.SyntheticWorkflowSession) WorkflowSession(com.day.cq.workflow.WorkflowSession) Date(java.util.Date)

Aggregations

SyntheticWorkItem (com.adobe.acs.commons.workflow.synthetic.impl.cq.SyntheticWorkItem)1 SyntheticWorkflowSession (com.adobe.acs.commons.workflow.synthetic.impl.cq.SyntheticWorkflowSession)1 SyntheticCompleteWorkflowException (com.adobe.acs.commons.workflow.synthetic.impl.cq.exceptions.SyntheticCompleteWorkflowException)1 SyntheticTerminateWorkflowException (com.adobe.acs.commons.workflow.synthetic.impl.cq.exceptions.SyntheticTerminateWorkflowException)1 WorkflowSession (com.day.cq.workflow.WorkflowSession)1 Date (java.util.Date)1