ci: 删除无用接口
处理子流程节点添加监听器问题的接口删除了
This commit is contained in:
-68
@@ -108,74 +108,6 @@ public class ModelerController {
|
||||
return Result.OK(modelId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入model文件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "模型名称")
|
||||
})
|
||||
@PostMapping("/importModelFileRecursion")
|
||||
public Result<String> importModelFileRecursion(@RequestPart(value = "file", required = false) MultipartFile file,
|
||||
@RequestParam(value = "name", required = false) String name) throws Exception {
|
||||
InputStream fileInputStream = file.getInputStream();
|
||||
XMLInputFactory xif = XMLInputFactory.newInstance();
|
||||
InputStreamReader in = new InputStreamReader(fileInputStream, "UTF-8");
|
||||
XMLStreamReader xtr = xif.createXMLStreamReader(in);
|
||||
// 转为bpmnModel
|
||||
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
|
||||
Model model = repositoryService.newModel();
|
||||
String modelKey = "m_" + CreatedTools.getCreated();
|
||||
ObjectNode modelNode = objectMapper.createObjectNode();
|
||||
modelNode.put(ModelDataJsonConstants.MODEL_NAME, modelKey);
|
||||
modelNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
|
||||
model.setName(name);
|
||||
model.setKey(modelKey);
|
||||
model.setMetaInfo(modelNode.toString());
|
||||
repositoryService.saveModel(model);
|
||||
String modelId = model.getId();
|
||||
Process mainProcess = bpmnModel.getMainProcess();
|
||||
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节点增加创建和完成时任务监听器工作
|
||||
processFlowElements(mainProcess.getFlowElements());
|
||||
ObjectNode objectNode = new BpmnJsonConverter().convertToJson(bpmnModel);
|
||||
repositoryService.addModelEditorSource(modelId, objectNode.toString().getBytes(StandardCharsets.UTF_8));
|
||||
//生成节点
|
||||
processModelNodeService.generateNode(modelId);
|
||||
return Result.OK(modelId);
|
||||
}
|
||||
|
||||
public void processFlowElements(Collection<FlowElement> flowElements) {
|
||||
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);
|
||||
} else if (flowElement instanceof SubProcess) {
|
||||
SubProcess subProcess = (SubProcess) flowElement;
|
||||
processFlowElements(subProcess.getFlowElements());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模板列表")
|
||||
@ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "名称"),
|
||||
|
||||
Reference in New Issue
Block a user