cancel
Showing results for 
Search instead for 
Did you mean: 

Using Domain Objects in the Process

j_p_ryan
Champ in-the-making
Champ in-the-making
Hi
I have an “Investigate Customer” process where flows in the business process use information from the Customer domain object to make decisions as to the path the process should follow e.g. amount owed, country region, manual or electronic etc.   
This customer object is a pre-existing and very complex object, persisted to/from an already existing database. 

What is the best practice in terms of the information that I pass around the process?  Should I pass the huge “Customer” object to the process as a variable or create another object that only contains the variables that the process needs to interrogate?

Another thought was to create the process with the “Customer Number” as the business key which would allow me to lookup and retrieve the current state of the customer, or possibly a process variable containing just the customer identifier.  Any examples on how best to do this if it is the best approach?

Thanks,
James
5 REPLIES 5

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
There is no wrong or one right way to do this. For JPA entities Activiti has a 'solution' where only the id is stored in activiti and the entity is loaded via the entitimanager it belongs to. In other cases you can mimic this by also storing the id (and maybe the class type) and having an el resolver that does the actual work, or load things in a base class of a service (which gets the id from a process variable)

But storing only those parts in the engine that are relevant often works very wel. So it is up to you

Just some random thoughts

j_p_ryan
Champ in-the-making
Champ in-the-making
Thanks Ronald,

… For JPA entities Activiti has a 'solution' where only the id is stored in activiti and the entity is loaded via the entitimanager it belongs to.

Any idea where I can find an example of how this is done?

Thanks,
James

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Would you be surprised if I said, read the fine manual? Oh and full examples are….. in the activiti examples…

j_p_ryan
Champ in-the-making
Champ in-the-making
Hi Ronald,

Yea I know…lazy person here spotted that 10 minutes after putting up the post.  Bit of a RTFM fault you might say.

Sorry forgot to update post and thanks again for the help,
James

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Smiley Very Happy