update 修改模板管理代码,删除导入模板时增加监听器代码,改用全局监听器

This commit is contained in:
lijiarao
2023-11-28 15:55:05 +08:00
parent 2338148274
commit 4395c29c9b
3 changed files with 1 additions and 76 deletions
@@ -101,37 +101,6 @@ public class ModelerController {
model.setVersion(version);
repositoryService.saveModel(model);
String modelId = model.getId();
List<ActivitiListener> executionListeners = mainProcess.getExecutionListeners();
ActivitiListener startListener = new ActivitiListener();
startListener.setEvent(BaseExecutionListener.EVENTNAME_START);
startListener.setImplementationType("class");
startListener.setImplementation(StartListener.class.getName());
executionListeners.add(startListener);
ActivitiListener endListener = new ActivitiListener();
endListener.setEvent(BaseExecutionListener.EVENTNAME_END);
endListener.setImplementationType("class");
endListener.setImplementation(EndListener.class.getName());
executionListeners.add(endListener);
mainProcess.setExecutionListeners(executionListeners);
//向所有userTask节点增加创建和完成时任务监听器工作
Collection<FlowElement> flowElements = mainProcess.getFlowElements();
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask) {
UserTask userTask = (UserTask) flowElement;
List<ActivitiListener> taskListeners = userTask.getTaskListeners();
ActivitiListener createListener = new ActivitiListener();
createListener.setEvent(TaskListener.EVENTNAME_CREATE);
createListener.setImplementationType("class");
createListener.setImplementation(CreateListener.class.getName());
taskListeners.add(createListener);
ActivitiListener completeListener = new ActivitiListener();
completeListener.setEvent(TaskListener.EVENTNAME_COMPLETE);
completeListener.setImplementationType("class");
completeListener.setImplementation(CompleteListener.class.getName());
taskListeners.add(completeListener);
userTask.setTaskListeners(taskListeners);
}
}
ObjectNode objectNode = new BpmnJsonConverter().convertToJson(bpmnModel);
repositoryService.addModelEditorSource(modelId, objectNode.toString().getBytes(StandardCharsets.UTF_8));
//生成节点