[jboss-user] [jBPM] - Re: Kindly help me in passing processVariables when Human Task completed.

Shobhit Tyagi do-not-reply at jboss.com
Tue May 14 10:47:11 EDT 2013


Shobhit Tyagi [https://community.jboss.org/people/roxy1987] created the discussion

"Re: Kindly help me in passing processVariables when Human Task completed."

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

--------------------------------------------------------------
Rajesh,

What I do is, rather than using completeWithResults(), I complete the task and set the variables like following : 


 public void setProcessVariables(final long intProcessInstId, final Map<String, Object> hshVariableMap)
{
  StatefulKnowledgeSession objKSession = BpmRepositoryConfig.createSession(); //Get the session.  
  try {
   objKSession.execute(new GenericCommand<Map<String, Object>>() {
    public Map<String, Object> execute(Context objContext) {
           StatefulKnowledgeSession objKSession = ((KnowledgeCommandContext) objContext).
                      getStatefulKnowledgesession();
           org.jbpm.process.instance.ProcessInstance objProcessInstance = (org.jbpm.process.instance.
                           ProcessInstance) objKSession.
                           getProcessInstance(intProcessInstId);
           VariableScopeInstance objVariableScope = (VariableScopeInstance) objProcessInstance.
                       getContextInstance(VariableScope.VARIABLE_SCOPE);
           Iterator<Map.Entry<String, Object>> objIterator = hshVariableMap.entrySet().iterator();
           while(objIterator.hasNext()) {
            Map.Entry<String, Object> objPairs = (Map.Entry<String, Object>)objIterator.next();
            objVariableScope.setVariable(objPairs.getKey(), objPairs.getValue());
           }
           return null;
       }
   });
  } catch(Exception objException) {
   objLogger.loggerError(objException);
  }
 }
--------------------------------------------------------------

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

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/20130514/43defff1/attachment.html 


More information about the jboss-user mailing list