That ought to work, and when defining an API it's a good idea to insulate 
yourself from changes to the jBPM object model, which is what the DTO 
accomplishes.  I assume that you will load the TaskInstance using the "id" 
property of the DTO, set the variables, and then call end() to transition the 
task?  One thing to watch out for:

1. User A loads the TaskInstance and gets a DTO with id=1 and version=1
2. User B loads the same TaskInstance and gets a DTO with id=1 and version=1
3. User B alters the DTO and makes a call to an update method.  The 
TaskInstance is re-loaded (version=1), modified, and saved.  The version is now 
2.
4. User A alters the DTO and makes a call to an update method.  The 
TaskInstance is re-loaded (version=2), modified, and saved.  The version is now 
3, and User B's changes may have been overwritten.

But I don't know of a better solution than yours.  The only thing I would 
recommend is storing the task instance version (if that property exists/is 
exposed) so that you can do an explicit manual version check before updating.  
Then again, lost updates may not be an issue if all you are doing is adding 
associated objects (comments, variables, etc.).  The lost update problem is an 
issue only if two users are modifying the same data (such as the value of the 
same process instance variable) or if one user adds a variable and another 
tries to remove the same variable.  And if you are transitioning at the end of 
every update then you should get an error on the second update anyway, which 
would roll back User A's changes.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931612#3931612

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931612


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to