Terminate a workflow using the payload(type: JCR_PATH) in code implementation? | Adobe Higher Education
Skip to main content
Level 2
October 16, 2015
Resuelto

Terminate a workflow using the payload(type: JCR_PATH) in code implementation?

  • October 16, 2015
  • 1 respuesta
  • 3036 visualizaciones

I could find the below code while searching:

Workflow workflow = wfSession.getWorkflow(workItem.getWorkflow().getId());

wfSession.terminateWorkflow(workflow);

Is the above implementation correct to achieve the goal?

How should the definition for wfSession and workItem objects look like?

Where/How do i use the payload, to fetch the instance id of the workflow?

Este tema ha sido cerrado para respuestas.
Mejor respuesta de smacdonald2008

You have access to all of these objects when writing a custom workflow step. These objects are arguments to the execute method:

public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args)

For example -- you can use this Java application logic from within the execute method:

Workflow workflow = wfSession.getWorkflow(workItem.getWorkflow().getId());

wfSession.terminateWorkflow(workflow);

Within the custom step - you have the ability to test an expression:

If (A > X)

    //DO something in the Workflow step

else

   //Termininate the workflow

To learn how to write a custom workflow step using the CQ 5.6 APIs -- see:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

For more information about the Workflow APIs -- see:

https://dev.day.com/docs/en/cq/current/javadoc/com/adobe/granite/workflow/exec/WorkflowProcess.html

1 respuesta

smacdonald2008
Level 10
October 16, 2015

You have access to all of these objects when writing a custom workflow step. These objects are arguments to the execute method:

public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args)

For example -- you can use this Java application logic from within the execute method:

Workflow workflow = wfSession.getWorkflow(workItem.getWorkflow().getId());

wfSession.terminateWorkflow(workflow);

Within the custom step - you have the ability to test an expression:

If (A > X)

    //DO something in the Workflow step

else

   //Termininate the workflow

To learn how to write a custom workflow step using the CQ 5.6 APIs -- see:

http://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

For more information about the Workflow APIs -- see:

https://dev.day.com/docs/en/cq/current/javadoc/com/adobe/granite/workflow/exec/WorkflowProcess.html