[jboss-user] [jBPM] - jBPM5.1 : Setting Process Variable from code(Using API)
Sandeep Sapra
do-not-reply at jboss.com
Thu Nov 10 12:47:14 EST 2011
Sandeep Sapra [http://community.jboss.org/people/sandeepsapra] created the discussion
"jBPM5.1 : Setting Process Variable from code(Using API)"
To view the discussion, visit: http://community.jboss.org/message/635990#635990
--------------------------------------------------------------
*Description :*
I am trying to create a business process having two tasks :
a) Enter Comments Task to be entered by author and
b) Verify comments Task : To approve or reject comments entered by author.
If the comments are approved the process will end and if it is rejected , control will flow back to user task to enter comments by author.
Approve is set in BPMN by setting a process variable : approvalStatus as 1 and for reject it i set to 0.
Eg:
<conditionExpression xsi:type="tFormalExpression" language=" http://www.java.com/java http://www.java.com/java" >
return approvalStatus.equals("1");
</conditionExpression>
*Problem:*
While starting the process, approvalStatus is set to 0 intially as :
Map<String, Object> params = new HashMap<String, Object>();
params.put("approvalStatus", "0");
// start a new process instance
pi = ksession.startProcess("com.sample.bpmn.comments",params);
I am then trying to set the process variable as 1 or 0 (depending on approve or reject) inside the code , but the same is not happening.
*Can anyone please tell if I am missing something or is there any other way to do so?*
*Code Snippet:*
//Some Code here.....................
String approvalStatusValue="0";
if(isCommentsApproved)
approvalStatusValue="1";
else
approvalStatusValue="0";
Map<String, Object> results = new HashMap<String, Object>();
results.put("approvalStatus", approvalStatusValue);
ContentData contentData = new ContentData();
contentData = new ContentData();
contentData.setAccessType(AccessType.Inline);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out;
try {
out = new ObjectOutputStream(bos);
out.writeObject(results);
out.close();
contentData = new ContentData();
contentData.setContent(bos.toByteArray());
contentData.setAccessType(AccessType.Inline);
} catch (IOException e) {
e.printStackTrace();
}
taskClient.complete(task1.getId(), "mary", contentData, taskOperationHandler);
Thanks and Regards,
Sandeep
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/635990#635990]
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/20111110/7b5102c3/attachment-0001.html
More information about the jboss-user
mailing list