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]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to