-
1. Re: Duplication of processDefinition
npe Apr 22, 2008 8:40 AM (in response to npe)It is important to precise that I create my process definitions programatically and so I don't have any access to the XML definition.
-
2. Re: Duplication of processDefinition
kukeltje Apr 22, 2008 12:13 PM (in response to npe)maybe something like a deep hibernate copy works
-
3. Re: Duplication of processDefinition
npe Apr 23, 2008 10:53 AM (in response to npe)Hi,
Thanks for the reply. I didn't know about deep copy and all this stuff so I had a look at it. I tried to use this library : http://sourceforge.net/projects/beanlib/
in order to create a process Definition copy.
Then, I bumped into a problem quite unexpected :
In process definition there are two setters for startState :public void setStartState(Node startState) { this.startState = startState; }
andpublic void setStartState(StartState startState) { if ( (this.startState!=startState) && (this.startState!=null) ){ removeNode(this.startState); } this.startState = startState; if (startState!=null) { addNode(startState); } }
The thing is that the getStartState returns a node (actually I really don't understand why a node and not a StartState and why the startState property is a node and not a StartState as well... ) and so processDefinition is not exactly a bean and the library I tried to use fail to copy because it tries to do :newObject.setStartState(oldObject.getStartState());
with the method taking a startState.
I am really wondering what are the technical reasons of such a thing. -
4. Re: Duplication of processDefinition
kukeltje Apr 23, 2008 4:24 PM (in response to npe)I am really wondering what are the technical reasons of such a thing.
Probably nothing special and it just 'evolved' into this -
5. Re: Duplication of processDefinition
npe Jun 19, 2008 5:28 AM (in response to npe)Hi,
After changing of problem and trying differents method to do this I am getting more and more clueless on how to do this.
The deep copy doesn't work because of the non-bean properties of some jbpm objects.
Does someone have any idea ? -
6. Re: Duplication of processDefinition
vsevel Jun 20, 2008 2:46 AM (in response to npe)I am also interested by this topic since it is not a good idea to export a process definition as xml. see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=135563
What is the solution for building a new process definition which is very similar (or an extension) of a previous (already defined) process definition?
It is not convenient to restart from scratch.
Thanks,
Val -
7. Re: Duplication of processDefinition
olivier_debels Jun 20, 2008 4:11 AM (in response to npe)You could start extending the previous process definition from its processdefinition.xml.
This one is saved in the database (besides gpd.xml en process image). Can be retrieve using FileDefinition.
So when extending a process definition you can retrieve its xml and start from there. Make sure you first rename the process definition.
Hope this helps,
Olivier. -
8. Re: Duplication of processDefinition
npe Jun 20, 2008 4:18 AM (in response to npe)Hi,
Thanks for your reply.
The problem is that I design my process definition directly through the objects of the "definition graph". I don't use the eclipse graphical designer nor the XML to parse into a definition.
As I have very simple definitions to create I developed a web based designer that design the process directly on the objects and then deploy it on the database.
From this point what I want to do is duplicate a process definition and I couldn't find an "easy" way to do it. -
9. Re: Duplication of processDefinition
olivier_debels Jun 20, 2008 4:53 AM (in response to npe)Just another thought in your case:
Maybe you could use serialization to do the cloning? -
10. Re: Duplication of processDefinition
npe Jun 20, 2008 8:54 AM (in response to npe)Problem is that if you load a process definition via hibernate and then serialize it you still keep a link to hibernate and when deserializing you still have all the links to other objects and exceptions as if you were trying to save a copied instance.
-
11. Re: Duplication of processDefinition
olivier_debels Jun 20, 2008 9:15 AM (in response to npe)Isn't there a possibility to remove hibernate link before serializing? I'm sure there is (evicting...)
BTW: If you go for this solution (serialization) keep in mind the disadvantages:
http://weblogs.java.net/blog/emcmanus/archive/2007/04/cloning_java_ob.html