JBoss Community

JBPM5 Task completion through API

created by npereira in jBPM - View the full discussion

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

 



Reply to this message by going to Community

Start a new discussion in jBPM at Community