You need to have at least the process instance id or the work item id
to get your things done.
session.startProcess("processName"); ---- This will always
starts a new process
You have to get hold of your process instance or you can directly
complete the work item if you have the work item id.
StatefulKnowledgeSession ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId,
kbase, null,
getEnvironment());
WorkflowProcessInstance inst = (WorkflowProcessInstance)ksession.getProcessInstance(<<process
instance id>>);
……..get hold of the work item and complete it
OR
If you have the work item id already you can do this directly
ksession.getWorkItemManager().completeWorkItem(<<workitemid>>,
null);
-----Original Message-----
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of Scott Stevenson
Sent: Thursday, November 19, 2009 11:00 AM
To: Rules Users List
Subject: [rules-users] How do I resume a paused process?
I have a process that pauses after a few nodes are executed because it
reaches a Human Task node. I retrieve the persisted session with the
following code:
JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase,
null,
getEnvironment());
Once I have this session object I'm not sure how to resume the paused
process? I want to signal the Human Task work item as complete and have
the process resume at that point. I've tried this code:
WorkItemManager wm = session.getWorkItemManager();
wm.registerWorkItemHandler("Approve", new
WSHumanTaskHandler());
WorkflowProcessInstance pi = (WorkflowProcessInstance)
session.startProcess("processName");
Object[] nodes = pi.getNodeInstances().toArray();
WorkItem wi = ((HumanTaskNodeInstance) nodes[0]).getWorkItem();
wm.completeWorkItem(wi.getId(), null);
session.dispose();
The result of this is that the workflow restarts from the first node
and
completes to the end. I expected that the workflow would start at the
persisted location. What am I missing here?
Scott Stevenson
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users