Discussion:
[jboss-user] [jBPM] - Completing a human task with results
Gareth Edwards
2013-01-23 09:28:13 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Completing a human task with results"

To view the discussion, visit: https://community.jboss.org/message/793717#793717

--------------------------------------------------------------
Hi,

I can complete a human task using the TaskClient  like so:

ContentData contentData = ContentMarshallerHelper.marshal(content,  null);
        BlockingTaskOperationResponseHandler taskResponseHandler = new BlockingTaskOperationResponseHandler();

        client.complete(taskId, userId, contentData, taskResponseHandler);

        taskResponseHandler.waitTillDone(2000);


But how can I complete a task a get a result?

The TaskClient API has two complete methods:

*http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/service/TaskClient.html#complete(long, java.lang.String, org.jbpm.task.service.ContentData, org.jbpm.task.service.TaskClientHandler.TaskOperationResponseHandler) complete*(long taskId, http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true String userId, http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/service/ContentData.html ContentData outputData, http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/service/TaskClientHandler.TaskOperationResponseHandler.html TaskClientHandler.TaskOperationResponseHandler responseHandler)

and
*http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/service/TaskClient.html#completeWithResults(long, java.lang.String, java.lang.Object, org.jbpm.task.service.TaskClientHandler.TaskOperationResponseHandler) completeWithResults*(long taskId, http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true String userId, http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true Object results, http://docs.jboss.org/jbpm/v5.4/javadocs/org/jbpm/task/service/TaskClientHandler.TaskOperationResponseHandler.html TaskClientHandler.TaskOperationResponseHandler responseHandler)

I am using the first method as I need to pass in data on completion.
The second method appears to return results on completion but doesn't allow for passing in of content data.
How can I complete a human task with content data and get back a result?

Thanks in advance,

Gareth.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/793717#793717]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Maciej Swiderski
2013-01-23 10:29:48 UTC
Permalink
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Completing a human task with results"

To view the discussion, visit: https://community.jboss.org/message/793735#793735

--------------------------------------------------------------
the completWithResults method hides the content marshalling stuff so you can simply pass your result data (usually Map) instead of preparing ContentData object first.

What results you want to get back after task is completed? When completing you are giving the results to the task server so you already have results...

HTH
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/793735#793735]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-23 10:38:36 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Completing a human task with results"

To view the discussion, visit: https://community.jboss.org/message/793741#793741

--------------------------------------------------------------
I would like the system I am building to be a bit more interactive.
I am building my own REST API and when completing a task e.g. Verifying a user it would be helpful to get back the result from the human task to immediately notify the user that the verification failed.

Gareth.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/793741#793741]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Gareth Edwards
2013-01-24 12:24:33 UTC
Permalink
Gareth Edwards [https://community.jboss.org/people/garethed] created the discussion

"Re: Completing a human task with results"

To view the discussion, visit: https://community.jboss.org/message/794016#794016

--------------------------------------------------------------
I realise that this doesn't make sense.
I will use a custom service task to update a database and query that.

Slight misunderstanding on my part.

Gareth.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/794016#794016]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...