-
1. Re: What exactly is ProcessInstance ?
ralfoeldi Jan 27, 2006 2:28 AM (in response to neelixx)Hi Aaron,
jBPM doesn't know... unless you tell it.
How about calling processInstance.getContextInstance().setVariable()?
Greetings -
2. Re: What exactly is ProcessInstance ?
enazareno Jan 27, 2006 7:35 AM (in response to neelixx)Hi Aaron,
The process instance has a getId() method that returns the unique number of your process instance. You can use that to retrieve your process instances. If you want to retrieve using your defined names you can store it as a variable like Ralfoeldi has suggested. If you're ok with retrieving it using sql, you can check it out in the jbpm_variableinstance table, it contains the variable and the related process instance id.
Regards,
Elmo -
3. Re: What exactly is ProcessInstance ?
neelixx Jan 27, 2006 9:54 AM (in response to neelixx)Thanks RAlfoeldi and enazareno! I appreciate you taking the time to help me understand!
"enazareno" wrote:
The process instance has a getId() method that returns the unique number of your process instance.
So, keeping with this method, I can store the processInstanceID in my objects, to load at any time?public class Request { String name; Date dateCreated; Date dateRequested; long workflowID; public long getWorkflowID() { if (workflowID == null) { // obtain a JBpm session and processInstance workflowID = processInstance.getId(); } return workflowID; } public void setWorkflowID(long id) { this.workflowID = id; } }
Am I on the right track so far? Again, keeping to this effect, I can load the JBpm process using:processInstance = graphSession.loadProcessInstance(request.getWorkflowID());
Is my understanding right?
Thanks for your help, and your time! If I'm correct in my understanding for processInstances, my next learning challenge is task lists and assignments ((grin))
Again, thanks.
~~Aaron -
4. Re: What exactly is ProcessInstance ?
ralfoeldi Jan 27, 2006 10:02 AM (in response to neelixx)Hi Aaron,
just a thought: isn't your processInstance your HolidayRequest?
Things get a lot easier if the processInstance is the leading entity.
There might be situations where the other way around is required i.e. an entity keeps track of it's processInstances (e.g. if more than one processInstance can be connected to an entity) but that isn't the usual situation.
Greetings -
5. Re: What exactly is ProcessInstance ?
neelixx Jan 27, 2006 11:41 AM (in response to neelixx)"RAlfoeldi" wrote:
isn't your processInstance your HolidayRequest?
Yes it is. I'm using EJB3 EntityBeans for my project."RAlfoeldi" wrote:
Things get a lot easier if the processInstance is the leading entity.
What do you mean by "leading entity"? Maybe that's where I'm getting confused at.
Thanks!! -
6. Re: What exactly is ProcessInstance ?
ralfoeldi Jan 27, 2006 12:22 PM (in response to neelixx)Hi Aaron,
another attempt:
Your processInstance is a data object that traverses a process as defined in the processDefinition. It can basically handle any variables you might need. What I was suggesting is that there might not be any need for a seperate HolidayRequest object. Just use the processInstance. If the required data is to large for jBPM to efficiently handle just keep a key to an external data obejct, but the 'leading entity', the one that knows about state etc. remains the processInstance.
The other way around would be something like: long running contract (years) with various processes that are executed over a certain period, maybe even concurrently. Then it would make sense to let the contract keep track of the processInstances doing something to it. (The implementation might be the other way around, but that isn't the point.) In this case you would maybe want to ask: who is working on this contract?
Just my 2 cents. As always there are a thousand different ways to solve things.
Greetings -
7. Re: What exactly is ProcessInstance ?
neelixx Jan 27, 2006 1:25 PM (in response to neelixx)Rainer,
I see now. Thanks for taking the extra time to explain to me.
Basically, you are saying let the processInstance be my main object, storing the variables I need.
That makes sense. It keeps things simple and centralized.
Unfortunately, I think I'd rather do it the other way (i.e. Having my Entity Bean reference the processID), as my Entity Beans will be used by other outside processes (such as Crystal Reports, other external systems, etc).
So, I will need a table for my object's data, and then reference JBpm to assess the current state, and it's workflow.
Please correct me if I'm wrong.
I think I'm ready to start planning my architecture.
Thanks again! -
8. Re: What exactly is ProcessInstance ?
ralfoeldi Jan 28, 2006 5:11 AM (in response to neelixx)Hi Aaron,
you're on the right track.If the required data is to large for jBPM to efficiently handle just keep a key to an external data obejct, but the 'leading entity', the one that knows about state etc. remains the processInstance.
Greetings