JBoss Community

Re: Can a POJO be Parameter Mapped?

created by Gary Struthers in jBPM - View the full discussion

The reason the service task parameter worked after removing the Human Task is that the TestWorkItemHandler(s) I copied from examples completed the task with null results. Once I passed the pojo to workItemManager.completeWorkItem(...) my service task method then got the pojo. This means you have to customize your testWorkItemHandlers to complete with the result you expect.

 

class MyAutomaticHumanSimulatorWorkItemHandler implements WorkItemHandler {

          private List<WorkItem> workItems = new ArrayList<WorkItem>();

 

          public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) {

                    workItems.add(workItem);

                    System.out.println("Map of Parameters = " + workItem.getParameters());

  PIvars vars = (PIvars) workItem.getParameter("vars");

                    vars.setCanScore(true);

                    vars.setScore(new BigDecimal(4));

                    Map<String,Object>results = new HashMap();

                    results.put("vars", vars);

                    workItemManager.completeWorkItem(workItem.getId(), results);

                    System.out.println("Workitem completed  " + workItem.getName());

  }

Reply to this message by going to Community

Start a new discussion in jBPM at Community