Hi,
i need to execute a custom workflow that contains the default step plus a Process Step.
The Process Step links to:
public class MyProcess implements JavaProcessExt { /** Default log. */ protected final Logger log = LoggerFactory.getLogger(MyProcess.class); public void execute(WorkItem item, WorkflowSession session, String args[]) throws Exception { WorkflowData workflowData = item.getWorkflowData(); log.info("ok!!!"); } public void execute(WorkItem item, WorkflowSession session) throws Exception { String[] args = new String[]{"true"}; execute(item, session, args); } }
If i launch the workflow with the sidekick:
[img]93020c6a.png[/img]
This is my log:
[img]Untitled.png[/img]
The final step is completed but the workflow still remains in running. Why?
Now i need to call this workflow inside java code:
log.info("payload "+payload+" workflow_path "+workflow_path); session= this.repository.loginAdministrative(null); WorkflowSession wfSession = workflowService.getWorkflowSession(session); WorkflowModel wfModel = wfSession.getModel(workflow_path); WorkflowData wfData = wfSession.newWorkflowData("JCR_PATH", payload); log.info(wfModel+" "+wfData);
When i print the variables the wfData is a correct object but the wfModel is null. The workflow_path variable is "/etc/workflow/models/test" and is correct (you can see this on the first attached image).
Where is the mistake?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
When invoking a workflow with the API - ensure you reference the correct model. Here is a community for this community members wanting to know more about invoking a workflow model via the AEM Workflow API:
https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html
Views
Replies
Total Likes
When you are starting the workflow programmatically, make sure you are closing all the session including workflow session !
Views
Replies
Total Likes
The first thing that jumps out to me is the class that you use in the custom step.
public class MyProcess implements JavaProcessExt
(Deprecated. Use WorkflowProcess
instead)
When creating a custom step - you should implement:
com.adobe.granite.workflow.exec.WorkflowProcess
Also - please post a screenshot of the workflow model so the community can get a better understanding what you are trying to do.
Views
Replies
Total Likes
So its in a running mode after it completes?
Views
Replies
Total Likes
When invoking a workflow with the API - ensure you reference the correct model. Here is a community for this community members wanting to know more about invoking a workflow model via the AEM Workflow API:
https://helpx.adobe.com/experience-manager/using/invoking-experience-manager-workflows-using.html
Views
Replies
Total Likes
I have resolved the second problem with the change of: /etc/workflow/models/test to /etc/workflow/models/test/jcr:content/model
Views
Replies
Total Likes
Now i'm using WorkflowProcess but nothing is changed.
This is the model.xml of the process step:
<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:isCheckedOut="{Boolean}false" jcr:primaryType="cq:WorkflowModel" jcr:uuid="771f74e9-c4dc-41e0-83f7-a06548e00ae9" sling:resourceType="cq/workflow/components/model" description="No Description" title="test"> <metaData cq:lastModified="{Long}1443186943012" cq:lastModifiedBy="admin" jcr:primaryType="nt:unstructured"/> <nodes jcr:primaryType="nt:unstructured"> <node0 jcr:primaryType="cq:WorkflowNode" title="Start" type="START"> <metaData jcr:primaryType="nt:unstructured"/> </node0> <node1 jcr:primaryType="cq:WorkflowNode" description="Description of step 1" title="Step 1" type="PARTICIPANT"> <metaData jcr:primaryType="nt:unstructured" PARTICIPANT="admin"/> </node1> <node2 jcr:primaryType="cq:WorkflowNode" title="Double click to enter a title" type="PROCESS"> <metaData jcr:primaryType="nt:unstructured" PROCESS="mypath.MyProcess"/> </node2> <node3 jcr:primaryType="cq:WorkflowNode" title="End" type="END"> <metaData jcr:primaryType="nt:unstructured"/> </node3> </nodes> <transitions jcr:primaryType="nt:unstructured"> <node0_x0023_node1 jcr:primaryType="cq:WorkflowTransition" from="node0" rule="" to="node1"> <metaData jcr:primaryType="nt:unstructured"/> </node0_x0023_node1> <node1_x0023_node2 jcr:primaryType="cq:WorkflowTransition" from="node1" rule="" to="node2"> <metaData jcr:primaryType="nt:unstructured"/> </node1_x0023_node2> <node2_x0023_node3 jcr:primaryType="cq:WorkflowTransition" from="node2" to="node3"> <metaData jcr:primaryType="nt:unstructured"/> </node2_x0023_node3> </transitions> </jcr:root>
Views
Replies
Total Likes
Views
Likes
Replies