[jboss-user] [jBPM] - Re: jBPM WorkItemHandler problem: when Object is passed as param it's transformed to String.

annah do-not-reply at jboss.com
Fri May 4 09:34:34 EDT 2012


annah [https://community.jboss.org/people/annah] created the discussion

"Re: jBPM WorkItemHandler problem: when Object is passed as param it's transformed to String."

To view the discussion, visit: https://community.jboss.org/message/733820#733820

--------------------------------------------------------------
Hi Adam!


I had the same problem with our custom tasks, and found out that there is an unecpected editor behaviour when saving&reading a BPMN model. As you can see in Properties view, the editor uses XStream to serialize objects, and it all works until you save your model. But when you click Save, the object is saved to file using toString method instead of using XStream. Also when reading from the model, it is read as string, instead of deserializing the object. As a consequence you will always get a string when calling  +work.getParameter("myParameter").+ I noticed this behaviour not only for Object types, but for every data type (including Integer, Float etc. which should be supported according to specification).
I don't know if this is a bug or it should really work this way.... unfortunately I didn't get any answer on this forum when I raised this question a month ago  :( 

I solved this problem by serializing/deserializing the object myself, using:
- to save parameter to workitem: +work.setParameter("+myParameter+", xstream.toXML(data));+
- to read from work item: +(My_Object) xstream.fromXML((String) workItem.getParameter("myParameter"));+

Hope this helps.

I also noticed the delay probleim with Properties view, but haven't tried to solve it.+
+
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/733820#733820]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120504/340502c0/attachment.html 


More information about the jboss-user mailing list