This content has been marked as final.
Show 1 reply
-
1. Re: Help me Understand linking a process to an instance of a
kukeltje Sep 24, 2005 4:34 PM (in response to neelixx)"Neelixx" wrote:
I'm trying to learn more about jBPM, as I can use it in several of my projects. However, in going over the documentation, I'm left feeling that there are some gaps in my understanding.
In the documentation, you show how you can load a "waiting" instance of the workflow, using the method:jbpmSession.findLatestProcessDefinition("ProcessDefinitionName");
Wrong, this finds the latest definition of a process, not a process instance"Neelixx" wrote:
Since you can obviously have hundreds of this specific Process Definition tied to other objects, how can you get the specific Process for the specific object instance?
I hope not... hundreds of process definitions tied to objects.... maybe instances, but what do you mean by 'tied'"Neelixx" wrote:
Again, what do you mean by 'tied' and what kind of objects? If you mean you have some own data that is being used in process instances ( and I hope not in multiple ones) than you need some kind of mapping. Either outside jBPM (which I advise) or inside (store the primary key of your object in a process variable
I saw how you can load a specific ProcessInstance using:List processInstances = graphSession.findProcessInstances(processDefinition.getId()); ProcessInstance processInstance = (ProcessInstance) processInstances.get(0);
Obviously, this loads the first instance in the List. Not only that, but I have to build a List of all ProcessInstances? But how do we know which instance is tied to which object?"Neelixx" wrote:
See previous remark
Is there a way (and I'm sure there is, I just haven't seen it yet) to grab the id of the processInstance as soon as one is created for an object? How?"Neelixx" wrote:
What about storing it somewhere? Would be the most logical thing to me
I can create a new ProcessDefinition for object1, but then, how do I retrieve the id of that ProcessDefinition for later re-use and/or action to it? Kinda like (suedo):"Neelixx" wrote:
Yep... that's what I do toobject1.setBpmId(processInstance.getId());
"Neelixx" wrote:
Look at the api.... it's all there
Then, several weeks later, I'm ready to kick off another transition to this object, I can just load the current ProcessInstance tied to that object (suedo):ProcessInstance processInstance = jbpmSession.loadInstance(object1.getBpmID());
I guess I'm just wondering how I can get a processInstance ID, as the instance is freshly created without having to build a List of ALL the processInstances, AND, how can load that processInstance ID when I'm ready for it?"Neelixx" wrote:
There is nothing wrong with your understanding... I even bet that the time it took you to write this, you could have found it in the api to. You even used the right class allready http://docs.jboss.com/jbpm/v3/javadoc/org/jbpm/db/GraphSession.html#loadProcessInstance(long)
I'm sure it's in the documentation, so if it is, I apologize now. You can just send me the link. If not, can I get some clarification on using this in the "real world"?"Neelixx" wrote:
Thank you!
Any time, but besides using the documentation also use the javadoc. Or better, a code completion IDE which shows you the javadoc (like eclipse)
Saves you a lot of time