-
1. Re: [URGENT] jBPM ProcessDefinition instance state and POJO
ahmed.adly May 17, 2006 8:54 AM (in response to ahmed.adly)So, long time waiting for reply,
I hope that is not a bad thing. any reply from any one in this forum moderators will be gracefully appreciated -
2. Re: jBPM ProcessDefinition instance state and POJO class sta
koen.aers May 22, 2006 2:24 AM (in response to ahmed.adly)Ahmed,
The reason why you have to wait this long is probably because no one (probably including me) has a clue of what you really mean... But I am gonna try anyway.
If you want to use (a reference to) your car as a process variable in the process instance: yes you can. Or if you want to externalize the state info of your car into individual process variables of the process instance: yes you can.
It is all up to you.
Regards,
Koen -
3. Re: jBPM ProcessDefinition instance state and POJO class sta
ahmed.adly May 22, 2006 5:54 AM (in response to ahmed.adly)Dear Koen,
I am very happy for your reply.
And I am sorry for you did not understand me. but I'll try to make it clear.
I want to create instance of this Process Definition. Then make the token to start at node #3 (which is do some maintenance to car) instead of start state without calling signal() method many time to go to node #3.
That mean
1. I want to create a Car process when admin login to add new car to the system.
2. Then after a time system manager login to rent this car.
3. after a period the manager login again to check that the car is return but need some maintenance.
.....etc.
I have seen your example that available with jBPM source, in this example there is something like this, but my case differs from that example, in my project I need to persiste Car POJO data with it's current state, the POJO data contains many attributes that are not supported using your instance variable that persisted in database in jbpm_variableinstance table such as Java Vector, Set, ArrayList, ...etc. Any way, variables and attributes of Car POJO will be persisted in Car Table, so we want not to persiste the token of process instance, and when manager login again retrieves the Car data and creates instance of Car Process Difinition and set the created token current node to node #3 (which is the state of the retrieved car) without make many signals to make token reachs this node.
By another mean, I want to make a synchronization between my POJO state and the created token state, because our project has offline booking module that can not persisted till my application connect to internet.
This is Urgent for us, it will make big difference in our project developing.
Thanks alot,
Ahmed. -
4. Re: jBPM ProcessDefinition instance state and POJO class sta
koen.aers May 25, 2006 7:33 AM (in response to ahmed.adly)Ahmed,
I still don't understand very well what you mean, but here we go again:
- To move the token around in your processdefinition you have to signal the token. If you have nodes where the process execution does not have to wait, use generic nodes instead of task nodes or states.
- To store the state of business objects like your car, you can use your normal way of doing things and use the id field of your car as a process variable in your process.
Regards,
Koen -
5. Re: jBPM ProcessDefinition instance state and POJO class sta
ahmed.adly Jun 5, 2006 1:53 PM (in response to ahmed.adly)Dear Koen,
Sorry for late about reply but I am busy in my work to login and reply, any way I have found the answer what I am looking for but I can not explain it now; when I finish my tasks and get some time I will expose what I have experienced, I promise. I am appreciating your reply -
6. Re: jBPM ProcessDefinition instance state and POJO class sta
ahmed.adly Jun 15, 2006 8:46 AM (in response to ahmed.adly)here I am, back again
I hope that reply help any one who need this.
this is a pice of code that get car POJO from database, assuming that the car state now in state #2 which is "2.rent a car from warehouse."//read definition XML file ProcessDefinition carProcessDefinition=ProcessDefinition.parseXmlResource(processDefFileName); //create new process instance from this definition ProcessInstance carProcessInstance=carProcessDefinition.createProcessInstance(); //get my car object from database Car car=carService.getCarById(carId); //get a state object in this process instance using the POJO object state //carState attribute in the car POJO is string that represent the node name //in the process definition. Node currentNode=(Node)carProcessDefinition.getNode(car.getCarState()); //now this will set the active (current) node of the process definition to equivalent //state of my CarPOJO class carProcessInstance.getRootToken().setNode(currentNode); //now we will signal to the next state which is doSomeMaintenance carProcessInstance.signal("doSomeMaintenance");
Thanks a lot,
Ahmed Adly