Esempio n. 1
0
        protected internal virtual void deleteCaseDeployment(string deploymentId, bool cascade)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;

            if (processEngineConfiguration.CmmnEnabled)
            {
                IList <CaseDefinition> caseDefinitions = CaseDefinitionManager.findCaseDefinitionByDeploymentId(deploymentId);

                if (cascade)
                {
                    // delete case instances
                    foreach (CaseDefinition caseDefinition in caseDefinitions)
                    {
                        string caseDefinitionId = caseDefinition.Id;

                        CaseInstanceManager.deleteCaseInstancesByCaseDefinition(caseDefinitionId, "deleted deployment", true);
                    }
                }

                // delete case definitions from db
                CaseDefinitionManager.deleteCaseDefinitionsByDeploymentId(deploymentId);

                foreach (CaseDefinition caseDefinition in caseDefinitions)
                {
                    string processDefinitionId = caseDefinition.Id;

                    // remove case definitions from cache:
                    Context.ProcessEngineConfiguration.DeploymentCache.removeCaseDefinition(processDefinitionId);
                }
            }
        }
Esempio n. 2
0
        protected internal virtual IList <CaseDefinition> getDeployedCaseDefinitionArtifacts(DeploymentEntity deployment)
        {
            CommandContext commandContext = Context.CommandContext;

            // in case deployment was created by this command
            IList <CaseDefinition> entities = deployment.DeployedCaseDefinitions;

            if (entities == null)
            {
                string deploymentId = deployment.Id;
                CaseDefinitionManager caseDefinitionManager = commandContext.CaseDefinitionManager;
                return(caseDefinitionManager.findCaseDefinitionByDeploymentId(deploymentId));
            }

            return(entities);
        }