Yogesh Yogesh - 1 year ago 124
Java Question

unable to read activiti bpmn from data in java class

i am very beginner to activiti bpmn. working with activiti-5.21.0. i have
i have created myProcess.bpmn, that have user task. user task have a form. can u please tell me steps, When this form will be submitted by assignee user i.e. "kermit" then How to read data submitted in form in java class.

myProcess.bpmn is like this:

<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="User Task" activiti:assignee="kermit">
<activiti:formProperty id="name" name="Name" type="string" required="true"></activiti:formProperty>
<activiti:formProperty id="comment" name="comment" type="string"></activiti:formProperty>
<activiti:executionListener event="start" class="com.demo.ActivitiForm"></activiti:executionListener>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow2" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>

Answer Source

Change Execution event="end" then try this -

package com.demo;

//all import statement

public class ActivitiForm implements ExecutionListener {

  public void notify(ExecutionListenerExecution execution) throws Exception {
    String name = (String) execution.getVariable("name");
    String comment = (String) execution.getVariable("comment");
    System.out.println(name + " made the following comment: " + comment);           //see this sys.out in your admin log.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download