flowable 流程引擎 根据 模型 ID 部署流程

半世苍凉 提交于 2021-01-25 17:07:46
	/**部署流程定义
	 * @return www.fhadmin.org
	 */
	@RequestMapping(value="/deployment")
	@RequiresPermissions("fhmodel:edit")
	@ResponseBody
	public Object deployment(){
		Map<String,Object> map = new HashMap<String,Object>();
		String result = "success";
		PageData pd = new PageData();
		pd = this.getPageData();
		try{
			deploymentProcessDefinitionFromUIModelId(pd.getString("modelId"));//部署流程定义
		}catch (Exception e){
			result = "error";
		}finally{
			map.put("result", result);
		}
		return map;
	}
/**部署流程定义(根据ui.modeler的 modelId部署)
	 * @param modelId 模型ID
	 * @return 部署ID 项目源码www.fhadmin.org
	 */ 
	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
	}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!