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&...]