-
1. Re: Current state of the process instance using APIs
kukeltje Sep 25, 2008 3:35 AM (in response to shansari)look at the testcases in the source. many 'examples' of these kinds of things
-
2. Re: Current state of the process instance using APIs
shansari Sep 25, 2008 4:22 AM (in response to shansari)Hi Ronald,
Thanks for your response.
I read through the examples.
Shows create the process instance first, on same process manipulates the nodes traversal.
I'm trying to get the process instance of the process already running.
I'm using the below code
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition pd = graphSession.findLatestProcessDefinition(processName);
ProcessInstance processInstance = jbpmContext.getProcessInstance(pd.getId());
System.out.println(" processInstance :"+processInstance);
I'm getting process instance is null.
Kindly help
With Regs
:Ansari S.H -
3. Re: Current state of the process instance using APIs
kukeltje Sep 25, 2008 4:30 AM (in response to shansari)The result you get is correct in combination with the wrong way of using it. There is a difference between a definition and instance. You cannot use the id of a definition to load an instance this way. Instances have there own id when you start an instance
-
4. Re: Current state of the process instance using APIs
shansari Sep 25, 2008 6:18 AM (in response to shansari)Hi Ronald,
Thanks for your response.
When I tried to get the Process Instance from the Process definition, I do get the process Id, what I see in the Web Console.
Kindly help me to get the right APIs to get the ProcessInstance, So as I can get the current status.
With Regs
:Ansari S.H -
5. Re: Current state of the process instance using APIs
kukeltje Sep 25, 2008 7:50 AM (in response to shansari)WHAT process instance? There can be hundreds, thousands of process instances for ONE process definition... So gettging THE process instance is kind of hard?
Normal usage is that you have a 'business key' in your domain model and set that in a process instance when you start it. You can retrieve THAT SPECIFIC process instance then by using that key. -
6. Re: Current state of the process instance using APIs
kukeltje Sep 25, 2008 8:19 AM (in response to shansari)but if you want them ALL (which I cannot imagine in a running server) you can use something like
jbpmContext.getGraphSession().findProcessInstances(processDefinitionId); -
7. Re: Current state of the process instance using APIs
shansari Sep 25, 2008 10:22 PM (in response to shansari)Hi Ronald,
Thanks a lot, It works.
In our requirement, at any point of time that particular process will be having one process instance or zero.
With Regs
:Ansari S.H