public override void Insert(IDeploymentEntity deployment) { Insert(deployment, false); var resources = deployment.GetResources().Values; foreach (IResourceEntity resource in resources) { resource.DeploymentId = deployment.Id; ResourceEntityManager.Insert(resource); } }
public virtual void DeleteDeployment(string deploymentId, bool cascade) { IList <IProcessDefinition> processDefinitions = new ProcessDefinitionQueryImpl().SetDeploymentId(deploymentId).List(); //判断是否存在正在执行的流程 long count = new ExecutionQueryImpl() .SetProcessDeploymentId(deploymentId) .Count(); //判断是否存在历史流程 count = count > 0 ? count : new HistoricProcessInstanceQueryImpl() .SetDeploymentId(deploymentId) .Count(); if (count > 0) { throw new ExistsProcessInstanceException(processDefinitions[0].Name); } updateRelatedModels(deploymentId); if (cascade) { deleteProcessInstancesForProcessDefinitions(processDefinitions); } foreach (IProcessDefinition processDefinition in processDefinitions) { deleteProcessDefinitionIdentityLinks(processDefinition); deleteEventSubscriptions(processDefinition); deleteProcessDefinitionInfo(processDefinition.Id); removeTimerStartJobs(processDefinition); // If previous process definition version has a timer/signal/message start event, it must be added // Only if the currently deleted process definition is the latest version, // we fall back to the previous timer/signal/message start event restorePreviousStartEventsIfNeeded(processDefinition); } deleteProcessDefinitionForDeployment(deploymentId); ResourceEntityManager.DeleteResourcesByDeploymentId(deploymentId); Delete(FindById <DeploymentEntityImpl>(new KeyValuePair <string, object>("id", deploymentId)), false); }