11-12-2018 02:06 AM
I want to override setAssignee method of activiti/alfersco workflow.How Can I do that?
I found that TaskEntity.java class is called during set assignee.
Is this proper way to change existing setAssignee below method of TaskEntity.java?
public void setAssignee(String assignee, boolean dispatchAssignmentEvent, boolean dispatchUpdateEvent) {}
11-12-2018 04:11 AM
Why do you want to change / override that method in the first place? Generally speaking it is not recommend / actually discouraged to make changes to the core classes / sources just to addess a business requirement. If you need some different behaviour from task assignment, you should implement a proper API facade / action wrapper around the things you need to adapt.
11-12-2018 04:17 AM
How Can I Implement API facade / action wrapper for setAssignee()?
Can you provide some help on that?
11-14-2018 04:01 AM
I don't want to sound rude, but the facade pattern is a common software design pattern. Any help I would provide would basically just be a TL;DR summary of that pattern at this point...
12-09-2018 08:35 AM
can you provide some more detail?
01-15-2019 01:14 AM
why not use taskListener instead? write your business logic on "assign" event then send the variable to the setAssignee
01-15-2019 11:35 PM
This is not for particular workflow.it is for all workflow.
can you describe how can i achieve?
01-16-2019 06:10 AM
you can a listener before every task assignment. This thread might help you - Does engine have a hook to install an event listener?
update: use AbstractBpmnParseHandler instead of AbstractBpmnParseListener (with 5.22 engine)
example:
public class AssingmentExample extends AbstractBpmnParseHandler<UserTask> {
@Override
protected void executeParse(BpmnParse arg0, UserTask userTask) {// add your custom logic here
userTask.setAssignee("// your assignee here");
}@Override
protected Class<? extends BaseElement> getHandledType() {
// TODO Auto-generated method stub
return null;
}}
Register this with your process engine configuration.
Explore our Alfresco products with the links below. Use labels to filter content by product module.