How to map process variables to task parameters in jBPM5?

Solution Unverified - Updated -

Issue

  • How can I code a human task client to modify an object from the process instance?
    To be precise here is what I want to achieve.
  1. I have an object from class OrderMsg, that has a bunch of properties.
  2. OrderMsg is set as a parameter in the process.
  3. The process stops at a human task.
  4. A task client reads the human task, and needs to set the cancelled property of the OrderMsg object to true, so that the next task in the process can see that this order is cancelled.

How can that be done? I am trying code in the task client similar to the following, but it does not work, the cancelled property is still false in the next task of the process.

TaskClient client = new TaskClient(new MinaTaskClientConnector("client 1", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
client.connect("127.0.0.1", 9123);
OrderMsg orderMsg = this.getOrderMsgFromTask(client, taskId); // uses GetResponseHandler
orderMsg.processControl.setCancelledInvoice(true);
SetDocumentResponseHandler setResponseHandler = new BlockingSetContentResponseHandler();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bos);
out.writeObject(orderMsg);
Content content = new Content();
content.setContent(bos.toByteArray());
out.close();
bos.close();
System.out.println("setting document content for task id " + taskId);
client.setDocumentContent(taskId, content, setResponseHandler);
this.startTask(taskId);
this.completeTask(taskId);

Environment

  • JBoss Enterprise Business Rules Management System Platform (BRMS)
    • 5.3.x
  • jBPM
    • 5.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content