package com.blueland.bpm.manage.web;

import org.activiti.bpmn.model.BpmnModel;
import org.springframework.beans.factory.annotation.Autowired;

import com.blueland.bpm.common.base.BaseSpringController;
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;

public class BaseProcessController extends BaseSpringController {
	@Autowired
	ProcessDefinitionService processDefinitionService;
	@Autowired
	ProcessInfoConfigManager processInfoConfigManager;
	public boolean updateBpmnModel(BpmnModel bpmnModel,String procDefId,boolean isUpdateProceImage){
		ProcessDefinitionModel processDefinition=processDefinitionService.getProcessDef(procDefId);
		processInfoConfigManager.setProcessInfoUpdateState(procDefId);
		return processDefinitionService.updateDeploymentResourceAndCache(bpmnModel,processDefinition,isUpdateProceImage);
	}
	
	public boolean updateBpmnModel(BpmnModel bpmnModel,ProcessDefinitionModel processDefinition,boolean isUpdateProceImage){
		processInfoConfigManager.setProcessInfoUpdateState(processDefinition.getProcDefId());
		return processDefinitionService.updateDeploymentResourceAndCache(bpmnModel,processDefinition,isUpdateProceImage);
	}
}
