[jboss-user] [jBPM Development] New message: "Storing java.util.Collection on process"

Ruben Bentein do-not-reply at jboss.com
Thu Feb 18 09:40:27 EST 2010


User development,

A new message was posted in the thread "Storing java.util.Collection on process":

http://community.jboss.org/message/527010#527010

Author  : Ruben Bentein
Profile : http://community.jboss.org/people/rubenbentein

Message:
--------------------------------------------------------------
I have a question about a best practise concerning processes with a dynamic list as a variable.
 
Let's say for example i have an process which has to store 0..* objects as variables. I.e. an process B
 
+public class B{+
+     string b1;+
+     string b2;
+
+     java.util.Collection<A> aCollection;
+
+}+
 
and a class A
+
+
+public class A{+
+     string a1;+
+     string a2;
+
+}+
 

so before calling
 
+executionService.startProcessInstanceByKey("B-process-name", variables);+
 
I have to fill the variables map. But how should i add aCollection ? Should i do something like
+
+
+variables.put("b1", someBObject.b1);+
+variables.put("b2", someBObject.b2);+
+for (int i=0 ; i<someBObject.aCollection.size() ; i++){
+
+     variables.put("aCollection[++" + i + "].a1", aCollection.get(i).a1++);
+
+     variables.put("aCollection[++" + i + "].a2", aCollection.get(i).a2);+
+}+
 
Or maybe there is a better/cleaner solution.
Or should i store these object in my own tables, and just store a reference (id) on the variables list ?
 
Thanks for any replies

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/527010#527010




More information about the jboss-user mailing list