作者:田大才子2016-10-8 15:08分类: Activiti
本文所有文字解释都在代码中以注释的方式存在。
请复制代码到自己喜欢的文本编辑器中观看。
public boolean deployeByModelID(ActivitiModel activitiModel) { try { org.activiti.engine.repository.Model modelData = repositoryService.getModel(activitiModel.getId()); ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId())); byte[] bpmnBytes = null; BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode); bpmnBytes = new BpmnXMLConverter().convertToXML(model); String processName = modelData.getName() + ".bpmn20.xml"; Deployment deployment = repositoryService.createDeployment() .name(modelData.getName()).addString(processName, new String(bpmnBytes,"UTF-8")) .deploy(); return true; } catch (Exception e) { logger.error("根据模型部署流程失败:modelId={}", activitiModel.getId(), e); } return false; }
发表评论:
昵称
邮件地址 (选填)
个人主页 (选填)
个人公众号,希望您的关注~
发表评论: