使用activiti 5.22 想全局定义任务监听器,结果试了多次发现没有效果。
最后看了看activiti的相关源码发现,流程定义里边没有处理 TaskListener 相关的操作,发现TaskListener 处理是在Task里边处理的,所以把TaskListener 定义在Task节点就好使了。
/*** 只有执行监听器 和 事件监听器*/
public class Process extends BaseElement implements FlowElementsContainer, HasExecutionListeners {protected String name;protected boolean executable = true;protected String documentation;protected IOSpecification ioSpecification;//执行监听器protected List<ActivitiListener> executionListeners = new ArrayList<ActivitiListener>();protected List<Lane> lanes = new ArrayList<Lane>();protected List<FlowElement> flowElementList = new ArrayList<FlowElement>();protected List<ValuedDataObject> dataObjects = new ArrayList<ValuedDataObject>();protected List<Artifact> artifactList = new ArrayList<Artifact>();protected List<String> candidateStarterUsers = new ArrayList<String>();protected List<String> candidateStarterGroups = new ArrayList<String>();//事件监听器protected List<EventListener> eventListeners = new ArrayList<EventListener>();}