[jboss-user] [jBPM] - Re: Any help how to play with WorkItemHandler with parameter mapping ?

rickylkl do-not-reply at jboss.com
Fri Oct 26 03:32:09 EDT 2012


rickylkl [https://community.jboss.org/people/rickylkl] created the discussion

"Re: Any help how to play with WorkItemHandler with parameter mapping ?"

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

--------------------------------------------------------------
Dear,

I try to update the src here.

private void testDrlJbpm(Channel channel){
*             Map<String,Object> map = new HashMap<String,Object>();*
                    map.put("channel", channel);
*               map.put("x","hello world");*
                    ksession.insert(channel);                                                  //          if there is a rule flow in workflow, need to insert obj to run rule
                    ksession.getWorkItemManager().registerWorkItemHandler("ShowRegPage", new RegistrationHandler());
 *ProcessInstance processInstance = (ProcessInstance) ksession.startProcess("testflow-web", map); *         //          passing map inside the process, and use kcontext.getvariable() to get obj on if else case
                    System.out.println(processInstance.getEventTypes());
                    System.out.println(processInstance.getId());
                    System.out.println(processInstance.getProcessId());
          ksession.fireAllRules();
          }


bpmn file:
*  <itemDefinition id="_xItem" structureRef="String" />*
*  <itemDefinition id="_35-xItem" structureRef="String" />*
*  <itemDefinition id="_32-xItem" structureRef="String" />*
*  <itemDefinition id="_33-xItem" structureRef="String" />*
  <process processType="Private" isExecutable="true" id="testflow-web" name="testflow-web" >

    <extensionElements>
     <tns:import name="org.drools.runtime.process.WorkflowProcessInstance" />
    </extensionElements>
    <!-- process variables -->
 *<property id="x" itemSubjectRef="_xItem"/>*

    <!-- nodes -->
    <task id="_35" name="ShowRegPage" tns:taskName="ShowRegPage" >
 *<ioSpecification>*
*        <dataInput id="_35_xInput" name="x" />*
*        <inputSet>*
*          <dataInputRefs>_35_xInput</dataInputRefs>*
*        </inputSet>*
*        <outputSet>*
*        </outputSet>*
*      </ioSpecification>*
*      <dataInputAssociation>*
*        <sourceRef>x</sourceRef>*
*        <targetRef>_35_xInput</targetRef>*
*      </dataInputAssociation>*
    </task>


work item handler:

@Override
          public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
  System.out.println("========= Executing registration =============" + workItem);
          }

result: workItem parameter *cant not GET 'X'* .... pls help  :( 

Best Regards
--------------------------------------------------------------

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

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/20121026/b43d4b62/attachment-0001.html 


More information about the jboss-user mailing list