コード例 #1
0
        protected internal virtual ISet <ProcessDefinitionGroup> groupByKeyAndTenant(IList <ProcessDefinition> processDefinitions)
        {
            ISet <ProcessDefinitionGroup> groups = new HashSet <ProcessDefinitionGroup>();
            IDictionary <ProcessDefinitionGroup, IList <ProcessDefinitionEntity> > map = new Dictionary <ProcessDefinitionGroup, IList <ProcessDefinitionEntity> >();

            foreach (ProcessDefinition current in processDefinitions)
            {
                ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity)current;

                ProcessDefinitionGroup group = new ProcessDefinitionGroup();
                group.key    = processDefinition.Key;
                group.tenant = processDefinition.TenantId;

                IList <ProcessDefinitionEntity> definitions = group.processDefinitions;
                if (map.ContainsKey(group))
                {
                    definitions = map[group];
                }
                else
                {
                    groups.Add(group);
                    map[group] = definitions;
                }

                definitions.Add(processDefinition);
            }

            return(groups);
        }
コード例 #2
0
        protected internal virtual void checkAuthorization(ProcessDefinitionGroup group)
        {
            IList <CommandChecker>          commandCheckers    = Context.CommandContext.ProcessEngineConfiguration.CommandCheckers;
            IList <ProcessDefinitionEntity> processDefinitions = group.processDefinitions;

            foreach (ProcessDefinitionEntity processDefinition in processDefinitions)
            {
                foreach (CommandChecker commandChecker in commandCheckers)
                {
                    commandChecker.checkDeleteProcessDefinitionById(processDefinition.Id);
                }
            }
        }
コード例 #3
0
            public override bool Equals(object obj)
            {
                if (this == obj)
                {
                    return(true);
                }
                if (obj == null)
                {
                    return(false);
                }
                if (this.GetType() != obj.GetType())
                {
                    return(false);
                }
                ProcessDefinitionGroup other = (ProcessDefinitionGroup)obj;

                if (string.ReferenceEquals(key, null))
                {
                    if (!string.ReferenceEquals(other.key, null))
                    {
                        return(false);
                    }
                }
                else if (!key.Equals(other.key))
                {
                    return(false);
                }
                if (string.ReferenceEquals(tenant, null))
                {
                    if (!string.ReferenceEquals(other.tenant, null))
                    {
                        return(false);
                    }
                }
                else if (!tenant.Equals(other.tenant))
                {
                    return(false);
                }
                return(true);
            }
コード例 #4
0
        protected internal virtual void deleteProcessDefinitions(ProcessDefinitionGroup group)
        {
            ProcessDefinitionEntity newLatestProcessDefinition = findNewLatestProcessDefinition(group);

            CommandContext           commandContext          = Context.CommandContext;
            UserOperationLogManager  userOperationLogManager = commandContext.OperationLogManager;
            ProcessDefinitionManager definitionManager       = commandContext.ProcessDefinitionManager;

            IList <ProcessDefinitionEntity> processDefinitions = group.processDefinitions;

            foreach (ProcessDefinitionEntity processDefinition in processDefinitions)
            {
                string processDefinitionId = processDefinition.Id;

                if (writeUserOperationLog)
                {
                    userOperationLogManager.logProcessDefinitionOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_DELETE, processDefinitionId, processDefinition.Key, new PropertyChange("cascade", false, cascadeToHistory));
                }

                definitionManager.deleteProcessDefinition(processDefinition, processDefinitionId, cascadeToHistory, cascadeToInstances, skipCustomListeners, skipIoMappings);
            }

            if (newLatestProcessDefinition != null)
            {
                ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
                DeploymentCache deploymentCache = configuration.DeploymentCache;
                newLatestProcessDefinition = deploymentCache.resolveProcessDefinition(newLatestProcessDefinition);

                IList <Deployer> deployers = configuration.Deployers;
                foreach (Deployer deployer in deployers)
                {
                    if (deployer is BpmnDeployer)
                    {
                        ((BpmnDeployer)deployer).addEventSubscriptions(newLatestProcessDefinition);
                    }
                }
            }
        }
コード例 #5
0
        protected internal virtual ProcessDefinitionEntity findNewLatestProcessDefinition(ProcessDefinitionGroup group)
        {
            ProcessDefinitionEntity newLatestProcessDefinition = null;

            IList <ProcessDefinitionEntity> processDefinitions     = group.processDefinitions;
            ProcessDefinitionEntity         firstProcessDefinition = processDefinitions[0];

            if (isLatestProcessDefinition(firstProcessDefinition))
            {
                foreach (ProcessDefinitionEntity processDefinition in processDefinitions)
                {
                    string previousProcessDefinitionId = processDefinition.PreviousProcessDefinitionId;
                    if (!string.ReferenceEquals(previousProcessDefinitionId, null) && !this.processDefinitionIds.Contains(previousProcessDefinitionId))
                    {
                        CommandContext           commandContext           = Context.CommandContext;
                        ProcessDefinitionManager processDefinitionManager = commandContext.ProcessDefinitionManager;
                        newLatestProcessDefinition = processDefinitionManager.findLatestDefinitionById(previousProcessDefinitionId);
                        break;
                    }
                }
            }

            return(newLatestProcessDefinition);
        }