7 Replies Latest reply on Sep 8, 2011 7:00 PM by sroot

    JBPM5 Content data problem


      Hi all!

      I was wondering if someone might be able to assist with this.

      I have a process with a custom task and User Task,

      I have Map and couple of Strings def


      ined as process variables.

      When the process goes to human task, and I retrieve


      the Content for the Task via the TaskClient using Mina, I am unable to restore the Map. I found the following in the HumanTaskExample and it is exactly what I was doing

      Content content = getContentResponseHandler.getContent();

      ByteArrayInputStream bis = new ByteArrayInputStream(content.getContent());

      ObjectInputStream in;

      in = newObjectInputStream(bis);

      Object result = in.readObject();


      Map<?, ?> map = (Map<?, ?>) result;



      The problem is that "result" at this point is seen as a java.lang.String. All of my data is there when I print it out but I am unable to cast it back to a map. My process variable Map is being set when I complete the previous workitem


      Am I missing something here? Looking at the JBPM source and examples it seems like this should work.



      I'd appreciate all input, thanks.



        • 1. Re: JBPM5 Content data problem

          Could please you share:

          1) your process definition

          2) how you are calling the taskClient.complete method?





          • 2. Re: JBPM5 Content data problem

            Thanks for responding.

            Process def attached to oringal post above.

            My problem is even before I call taskClient.complete.

            Its at the point where I retreive the Content and need to display data to the user. At that point content.getContent() I expect to return a byte array of type Map, but it is always String. It does have my Map key/value pairings and the values may themselves be another Map or even a List


            This is how I get the Content:






            public Content getContentForTask(Task task) {

            long documentContentId = task.getTaskData().getDocumentContentId();

            BlockingGetContentResponseHandler getContentResponseHandler =

            new BlockingGetContentResponseHandler();


            taskClient.getContent(documentContentId, getContentResponseHandler);


            return getContentResponseHandler.getContent();



            • 3. Re: JBPM5 Content data problem

              If I don't remember wrong, if you evaluate this expresion:



                        <from xsi:type="tFormalExpression">#{transportMap}</from>

                        <to xsi:type="tFormalExpression">_12_ContentInput</to>



              It is converted to string.


              You could try this one:





              • 4. Re: JBPM5 Content data problem
                • 5. Re: JBPM5 Content data problem

                  Hmmmm, so does that mean that you really can't have anything other than a String as a process variable if you want to be able to later retrieve and display it from the Content of a Task?


                  Note that I am using the WSHumanTaskHandler and in my custom task handler just before the User Task I set my Map on a resuts map and then pass the results Map when I complete the workItem:


                  Map<String, Object> resultsMap = new HashMap<String, Object>();

                  resultsMap.put("MYMAP", myMap);

                  resultsMap.put("OTHERSTUFF", otherStuff);

                  workItemManager.completeWorkItem(workItem.getId(), resultMap);


                  The next step is User Task and I then attemtpt to retrieve the original Map from Task Content.

                  • 6. Re: JBPM5 Content data problem

                    No, it does not mean so..

                    If you use the expresion assignment(<from xsi:type="tFormalExpression">#{transportMap}</from>), it is resolved as an string, but if you map your process variable like this



                    I think should work.


                    You can check for example here:



                    To see how that parameters to the user task are sent.

                    For example,






                    You can also check this post:




                    • 7. Re: JBPM5 Content data problem

                      Thanks Demian!

                      That was extremley helpful.

                      I have it working now.