Discussion:
[jboss-user] [jBPM] - Re: Task Human - Parameter Mapping
TC ONG
2012-04-12 09:12:39 UTC
Permalink
TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
Hello jBPM team~? Anyone? Is this even possible?
How to obtain the parameters from Java?
You need another year to solve this?
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mauricio Salatino
2012-04-12 09:18:36 UTC
Permalink
Mauricio Salatino [https://community.jboss.org/people/salaboy21] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
Are you using the TaskClient? with that you can get the content of the task and get the parameters. Which alternatives did you try already? Or are you waiting here until someone respond?
What errors are you getting? Can you give us more background about what are you trying to do?

Cheers
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Arun V G
2012-04-12 11:00:26 UTC
Permalink
Arun V G [https://community.jboss.org/people/arunvg] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
Hint

//Retrieve task
taskclient.getTask(taskId, responseHandler);
Task task = responseHandler.getTask();

long documentContentId = task.getTaskData().getDocumentContentId();

//Retrieve content using content id
taskclient.getContent(documentContentId, contentResponseHandler);
byte[] objectinBytes = contentResponseHandler.getContent().getContent();
TC ONG
2012-04-13 02:11:02 UTC
Permalink
TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
I *cannot* use the Parameter Mapping in the Human Task and pass value to my Java program.

However

I can use Content to pass value to my Java program.

Correct?

Thanks Arun for the sample code.
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
TC ONG
2012-04-13 05:42:07 UTC
Permalink
TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
I figured it out now.

Step 1: Create a variable in your process. (I use userComms, it's my POJO)
Loading Image... Loading Image...
Step 2: In the Human Task Parameter Mapping, map my variable to "Content".
(I always have this problem doing this. See https://community.jboss.org/message/729763#729763#729763 https://community.jboss.org/message/729763#729763 )
Loading Image... Loading Image...

Step 3: [Optional] In the On Entry Action of the Human Task, I set the value of my POJO. You can do it any way you like.
Question: is the kcontext.setVariable() necessary?
userComms = *new* UserComms();
userComms.setQuestion("Hello World~!");
kcontext.setVariable("userComms", userComms);
Step 4: Compile and run our process.

Step 5: Accessing your variable from the task's "Content"
                              BlockingGetTaskResponseHandler taskResponseHandler = new BlockingGetTaskResponseHandler();
                              taskClient.getTask(task1.getId(), taskResponseHandler);
                              Task task = taskResponseHandler.getTask();
long documentContentId = task.getTaskData().getDocumentContentId();
                              UserComms userComms = new UserComms();
                              BlockingGetContentResponseHandler contentResponseHandler = new BlockingGetContentResponseHandler();
                              taskClient.getContent(documentContentId, contentResponseHandler);
                              Content content = contentResponseHandler.getContent();
if (content != null){
                ByteArrayInputStream bais = new ByteArrayInputStream(content.getContent());
                ObjectInputStream ois;
try {
                    ois = new ObjectInputStream(bais);
                    Object obj = ois.readObject();
                    System.out.println("Object = " + obj.getClass());  // will return an empty string if not mapped properly
if(obj instanceof UserComms) {
                        userComms =(UserComms) obj;
                        System.out.println(userComms.getQuestion());
                    }
                } catch (IOException e) {
                    e.printStackTrace();
               } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
            }
And I got my POJO from the Content.
Happy. :)
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mantu Singh
2013-01-22 08:11:47 UTC
Permalink
Mantu Singh [https://community.jboss.org/people/mantusingh90] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
Hi https://community.jboss.org/people/devilkazuya99 TC ONG,

i am getting an error on running the same example........................can u help me out on this?
is same example working for u?

thanks

error is....

*Loading knowledge base.*
*Registering Human Task..*
*Hellooooo~~~!*
*no_male = null*
*Hello World~!?*
*org.jbpm.workflow.instance.WorkflowRuntimeException: [humanTaskFlow:1 - Scan no of male:2] -- null*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)*
*          at org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)*
*          at org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)*
*          at org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)*
*          at org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)*
*          at org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:35)*
*          at org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:194)*
*          at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:309)*
*          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:170)*
*          at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:140)*
*          at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1098)*
*          at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:320)*
*          at com.utsav.poc.LocalTaskClientTest.main(LocalTaskClientTest.java:68)*
*Caused by: java.lang.NullPointerException*
*          at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler.executeWorkItem(SyncWSHumanTaskHandler.java:270)*
*          at org.drools.process.instance.impl.DefaultWorkItemManager.internalExecuteWorkItem(DefaultWorkItemManager.java:70)*
*          at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:107)*
*          at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)*
*          ... 18 more*
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Mantu Singh
2013-01-22 13:52:53 UTC
Permalink
Mantu Singh [https://community.jboss.org/people/mantusingh90] created the discussion

"Re: Task Human - Parameter Mapping"

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

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

i have solved this problem , your https://community.jboss.org/thread/200045 https://community.jboss.org/thread/200045 post helped me on this.....thanks!!
but i still have one problem ... after completion of two user task it throws exception in Diverging getway.
this code is there for Diverging getway...

*<conditionExpression xsi:type="tFormalExpression" language=" http://www.java.com/java http://www.java.com/java" >System.out.println("no_male = " + no_male);*
*System.out.println("no_female = " + no_female);*
*System.out.println("actual_male = " + actual_male);*
*System.out.println("actual_female = " + actual_female);*

*System.out.println("compare = " + (*
*    ( no_male.equals( actual_male )) &amp;&amp;*
*    ( no_female.equals( actual_female ))*
*));*

*return (*
*    no_male.equals( actual_male ) &amp;&amp;*
*    no_female.equals( actual_female )*
*);</conditionExpression>*

*https://community.jboss.org/servlet/JiveServlet/showImage/2-793530-20178/a.bmp https://community.jboss.org/servlet/JiveServlet/downloadImage/2-793530-20178/310-398/a.bmp*
exception................!!!!!!
*org.jbpm.workflow.instance.WorkflowRuntimeException: [humanTaskFlow:1 - Gateway:6] -- Exception when trying to evaluate constraint Match in split Gateway*
*    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)*
*    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)*
*    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)*
*    at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)*
*    at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216)*
*    at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:196)*
*    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:247)*
*    at org.jbpm.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:90)*
*    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:309)*
*    at org.jbpm.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:285)*
*    at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)*
*    at org.drools.process.instance.impl.DefaultWorkItemManager.completeWorkItem(DefaultWorkItemManager.java:116)*
*    at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler$TaskCompletedHandler.handleCompletedTask(SyncWSHumanTaskHandler.java:361)*
*    at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler$TaskCompletedHandler.execute(SyncWSHumanTaskHandler.java:325)*
*    at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329)*
*    at org.jbpm.task.event.MessagingTaskEventListener.triggerPayload(MessagingTaskEventListener.java:76)*
*    at org.jbpm.task.event.MessagingTaskEventListener.handleEvent(MessagingTaskEventListener.java:92)*
*    at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:109)*
*    at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:49)*
*    at org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:569)*
*    at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:495)*
*    at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:83)*
*    at com.utsav.poc.LocalTaskClientTest.main(LocalTaskClientTest.java:121)*
*Caused by: java.lang.RuntimeException: Exception when trying to evaluate constraint Match in split Gateway*
*    at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:79)*
*    at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)*
*    ... 22 more*
*Caused by: java.lang.RuntimeException: unable to execute ReturnValueEvaluator:*
*    at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:132)*
*    at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:72)*
*    ... 23 more*
*Caused by: java.lang.NullPointerException*
*    at com.geneoz.flow.Process_com_geneoz_flow_HumanTaskFlow_b_a0f515366213482980bd0febe418f32c.returnValueEvaluator5(Process_com_geneoz_flow_HumanTaskFlow_b_a0f515366213482980bd0febe418f32c.java:48)*
*    at com.geneoz.flow.Process_com_geneoz_flow_HumanTaskFlow_b_a0f515366213482980bd0febe418f32cReturnValueEvaluator5Invoker.evaluate(Process_com_geneoz_flow_HumanTaskFlow_b_a0f515366213482980bd0febe418f32cReturnValueEvaluator5Invoker.java:18)*
*    at org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:130)*
*    ... 24 more*
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
TC ONG
2013-01-23 07:31:11 UTC
Permalink
TC ONG [https://community.jboss.org/people/devilkazuya99] created the discussion

"Re: Task Human - Parameter Mapping"

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

--------------------------------------------------------------
Check the split node.
--------------------------------------------------------------

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

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