02-08-2017 02:07 AM
I'm building the usertask and servicetask dynamically
default UserTask createUserTask(String id, String name, String assignee) {
UserTask userTask = new UserTask();
userTask.setName(name);
userTask.setId(id);
userTask.setAssignee(assignee);
return userTask;
}
default ServiceTask createServiceTask(String id, String name, boolean asyn) {
ServiceTask serviceTask = new ServiceTask();
serviceTask.setName(name);
serviceTask.setId(id);
serviceTask.setAsynchronous(asyn);
ActivitiListener al = new ActivitiListener();
ExtensionAttribute ea = new ExtensionAttribute("activti", "abc");
// serviceTask.setExecutionListeners(executionListeners);
return serviceTask;
}
how to add
<extensionElements>
<activiti:taskListener event="create" class="com.xy.z.TaskAssignmentHandler"></activiti:taskListener>
</extensionElements>
This dynamically using java code?
02-08-2017 02:54 AM
Hi Goutham P N,
this should resolve your issue:
ActivitiListener activitiListener = new ActivitiListener();
activitiListener.setEvent("create");
activitiListener.setImplementation("com.xy.z.TaskAssignmentHandler");
activitiListener.setImplementationType("class");
Now you just have to add it to the service task.
Niklas
02-08-2017 02:54 AM
Hi Goutham P N,
this should resolve your issue:
ActivitiListener activitiListener = new ActivitiListener();
activitiListener.setEvent("create");
activitiListener.setImplementation("com.xy.z.TaskAssignmentHandler");
activitiListener.setImplementationType("class");
Now you just have to add it to the service task.
Niklas
02-08-2017 03:03 AM
Thanks Niklas.
How about adding expressions? something like this,
<serviceTask id="st-approve-action" name="Approve Action" activiti:expression="${xyz.Service.send(postDetails)}"></serviceTask>
And
<sequenceFlow id="flow1" sourceRef="gw-accept-reject" targetRef="exclusivegateway1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approver1 == false}]]></conditionExpression>
</sequenceFlow>
Thanks,
Goutham
02-08-2017 04:01 AM
Hi Goutham,
service task:
serviceTask.setImplementation("${xyz.Service.send(postDetails)}");
serviceTask.setImplementationType("expression");
sequence flow:
sequenceFlow.setConditionExpression("${approver1 == false}");
Explore our Alfresco products with the links below. Use labels to filter content by product module.