What exactly is ProcessInstance ?
neelixx Jan 26, 2006 11:42 PMAll,
I'm trying to comprehend the methods used in JBpm. I'm building a helpdesk for my company using JBoss, and JBpm will really help me out.
My confusion is in the ProcessDefinition and ProcessInstance. In the tutorial for JBpm3.0 (Chapter 3.2 Database Example), a processDefinition is deployed with the name "Hello World".
Easy enough.
Where I fall short on, is how do you "attach" a java object instance to a specific instance in JBpm? The tutorial loads it as:
JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession(); jbpmSession.beginTransaction(); jbpmSession .getGraphSession() .saveProcessDefinition(processDefinition); ..... close the session and transaction ....
How does JBpm know that my, lets say, HolidayRequest#1234 is the object that is attached to that session?
It goes on, mimicking a seperate request:
ProcessDefinition processDefinition =
jbpmSession
.getGraphSession()
.findLatestProcessDefinition("hello world");
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
Token token = processInstance.getRootToken();
Okay, so I loaded up the process-definition "hello world" which is my workflow "map" so-to-speak, that all my HolidayRequests use. But, again, how does JBpm know that I'm talking about HolidayRequest#1234 when I "getRootToken()" ?
Obviously, HolidayRequest#1234 could be in the "pending" state, while HolidayRequest#567 could be in the "approved" state. How does JBpm know which object I'm talking about, when all I see is "findLatestProcessDefinition" and "getRootToken".
The HolidayRequest object is fictitious, but I could just as well be saying, TroubleTicket, or DocumentApproval objects. Any objects that would be defined to flow through the specific Process Definition.
I hope I'm clear on my confusion. I'm still scouring the docs, as I'm sure the answer is there somewhere.
Can anyone elaborate for me?
Thanks!
Aaron