2 Replies Latest reply on May 14, 2011 8:19 AM by npereira

    JBPM5 Task completion through API

    npereira

      Hi forum,

       

      I have an piece of java code that is completing the Tasks through the API.

       

      But I have facing an issue, the ideia is that on completion of a task I complete it with a new set of parameteres.

      For that matter I have to put the HashMap into the Content Object, and only then, complete the task.

       

      Here is the problem, whenever I do this, either being throuh client.SetDocumentContent or client.complete, this new data never gets persisted to the following activity.

       

      This is my code,

       

      //Creates a new Content to Fit in the Task

      HashMap newMap = new HashMap();

      newMap.put("TFirst", 1234);

      newMap.put("TSecond", "blabla");

       

      Object newObj = (Object)newMap;

       

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      ObjectOutputStream oos = new ObjectOutputStream(bos);

      oos.writeObject(newObj);

      oos.flush();

      oos.close();

      bos.close();

       

      byte[] newByteContent = bos.toByteArray ();

      Content neWContent = new Content();

      neWContent.setContent(newByteContent);

       

      //Sets content on Task

      client.setDocumentContent(task.getId(), neWContent, sresponseHandler);

       

      //Completes the task               

      BlockingTaskOperationResponseHandler qweresponseHandler = new BlockingTaskOperationResponseHandler();

      ContentData cd = new ContentData();

      cd.setContent(newByteContent);

      client.complete(task.getId(), userID, cd, qweresponseHandler);

       

      Am I missing something?

       

      Best regards,

      Nelson