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?
Solved! Go to Solution.
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
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
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
Hi Goutham,
service task:
serviceTask.setImplementation("${xyz.Service.send(postDetails)}");
serviceTask.setImplementationType("expression");
sequence flow:
sequenceFlow.setConditionExpression("${approver1 == false}");
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.