[jboss-user] [jBPM] - Re: How to set a process variable from java code ?

Ouadi BEL do-not-reply at jboss.com
Thu Mar 28 12:04:39 EDT 2013


Ouadi BEL [https://community.jboss.org/people/ouadi_dev] created the discussion

"Re: How to set a process variable from java code ?"

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

--------------------------------------------------------------
I've find the solution of this probelm.

In order to solve this problem, we need to use this version of task complete method:


    BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
 
   Map<String, Object> taskVariables = new HashMap<String, Object>();
   taskVariables.put(new String("o_validationResult"),Boolean.valueOf(true));
 
  ContentData contentData = null;
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out;
    try {
      out = new ObjectOutputStream(bos);
      out.writeObject(taskVariables);
      out.close();
      contentData = new ContentData();
      contentData.setContent(bos.toByteArray());
      contentData.setAccessType(AccessType.Inline);
    } catch (IOException ioe) {
                 ioe.printStackTrace();
    }
 
    client.complete(aTaskId, aOwnerId, contentData, responseHandler);
 


With this code the task completion with a map of variables must done successfully.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://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/20130328/34110290/attachment.html 


More information about the jboss-user mailing list