[jboss-user] [jBPM] - Re: Human task client on a different user GUI

Pierpaolo Lombardi do-not-reply at jboss.com
Tue Sep 13 03:24:55 EDT 2011

Pierpaolo Lombardi [http://community.jboss.org/people/pierx83] created the discussion

"Re: Human task client on a different user GUI"

To view the discussion, visit: http://community.jboss.org/message/626166#626166

Yes I was.
I use the TaskClient utilities. Here my code to start and to complete a task (the start method reads the input parameters and the complete one write the output parameters). I hope this can help you

  public Object start(String user,Task task) throws Exception {

this.taskClient.start(task.getId(),user, null);

BlockingGetTaskResponseHandler handlerT = new BlockingGetTaskResponseHandler();
this.taskClient.getTask(id, handlerT);
org.jbpm.task.Task t = handlerT.getTask();
TaskData taskData = t.getTaskData();
// System.out.println("TaskData = "+taskData);
BlockingGetContentResponseHandler handlerC = new BlockingGetContentResponseHandler();
this.taskClient.getContent(taskData.getDocumentContentId(), handlerC);
Content content = handlerC.getContent();
// System.out.println("Content= "+content);
ByteArrayInputStream bais = new ByteArrayInputStream(content.getContent());
ObjectInputStream ois = new ObjectInputStream(bais);

//parameter può essere un parametro di tipo primitivo o un oggetto
//a seconda del task che esegue il cast
Object parameter =ois.readObject(); 
// System.out.println("parameter = "+parameter);

return parameter;   //input parameter of the task

* Complete the task execution
public void complete(String user,Task task,Map<String,String> parameters){
ContentData contentData = null;
if (parameters != null) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out;
try {
out = new ObjectOutputStream(bos);
contentData = new ContentData();
} catch (IOException e) {

BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
this.taskClient.complete(task.getId(), user, contentData, responseHandler);

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110913/c49a55a5/attachment-0001.html 

More information about the jboss-user mailing list