/**部署流程定義(根據(jù)ui.modeler的 modelId部署)
* @param modelId 模型ID
* @from? fhadmin.cn
*/
protected String deploymentProcessDefinitionFromUIModelId(String modelId) throws Exception{
Model model = modelService.getModel(modelId);
BpmnModel bpmnModel = modelService.getBpmnModel(model);
Deployment deployment = repositoryService.createDeployment()
.name(model.getName())
.addBpmnModel(model.getKey() + ".bpmn", bpmnModel).deploy();
? ? ? ? return deployment.getId(); //部署ID
}
/**部署流程定義(從Classpath)
* @param name //部署名稱
* @param xmlpath //xml文件路徑
* @param pngpath //png文件路徑
* @from? fhadmin.cn
*/
protected String deploymentProcessDefinitionFromClasspath(String name, String xmlpath, String pngpath){
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment(); //創(chuàng)建部署對象
deploymentBuilder.name(name); //部署名稱
deploymentBuilder.addClasspathResource(xmlpath); //從文件中讀取xml資源
deploymentBuilder.addClasspathResource(pngpath); //從文件中讀取png資源
Deployment deployment = deploymentBuilder.deploy(); //完成部署
return deployment.getId(); //部署ID
}