[jboss-user] [jBPM] - Re: Java code accessing task variables

LOGANATHAN KRISHNAN do-not-reply at jboss.com
Wed May 4 05:20:45 EDT 2011


LOGANATHAN KRISHNAN [http://community.jboss.org/people/loga07] created the discussion

"Re: Java code accessing task variables"

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

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

In order to access varaibles inside the Human Task, you have to map those variables in to the Human Task in workflow definition using Parameter Mapping attribute in the properties tab. Note that the parameter map for the Human Task should be of 'Content' only. 

Also in the code, you have to invoke taskData.getDocumentContentId() to get the content which contains the parameter values that mapped in the definition. The sample code is as follows:

public static Object getContent(long contentId) {
        connect();
        Object obj = null;
        try {
            BlockingGetContentResponseHandler responseHandler = new BlockingGetContentResponseHandler();
            client.getContent(contentId, responseHandler);
            Content content = responseHandler.getContent();
            byte[] byteContent = content.getContent();
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
                    byteContent);

            ObjectInputStream inputStream = new ObjectInputStream(
                    byteArrayInputStream);
            obj = inputStream.readObject();
        } catch (Throwable t) {
            t.printStackTrace();
        }
        return obj;
    }


Hope this helps to solve your problem.

Regards,
Loga
--------------------------------------------------------------

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

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

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


More information about the jboss-user mailing list