Beispiel #1
0
        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);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public java.util.List<ExecutionEntity> findExecutionsByQueryCriteria(org.camunda.bpm.engine.impl.ExecutionQueryImpl executionQuery, org.camunda.bpm.engine.impl.Page page)
        public virtual IList <ExecutionEntity> findExecutionsByQueryCriteria(ExecutionQueryImpl executionQuery, Page page)
        {
            configureQuery(executionQuery);
            return(DbEntityManager.selectList("selectExecutionsByQueryCriteria", executionQuery, page));
        }
Beispiel #3
0
        protected internal virtual IList <CorrelationHandlerResult> correlateMessageToExecutions(CommandContext commandContext, string messageName, CorrelationSet correlationSet)
        {
            ExecutionQueryImpl query = new ExecutionQueryImpl();

            IDictionary <string, object> correlationKeys = correlationSet.CorrelationKeys;

            if (correlationKeys != null)
            {
                foreach (KeyValuePair <string, object> correlationKey in correlationKeys.SetOfKeyValuePairs())
                {
                    query.processVariableValueEquals(correlationKey.Key, correlationKey.Value);
                }
            }

            IDictionary <string, object> localCorrelationKeys = correlationSet.LocalCorrelationKeys;

            if (localCorrelationKeys != null)
            {
                foreach (KeyValuePair <string, object> correlationKey in localCorrelationKeys.SetOfKeyValuePairs())
                {
                    query.variableValueEquals(correlationKey.Key, correlationKey.Value);
                }
            }

            string businessKey = correlationSet.BusinessKey;

            if (!string.ReferenceEquals(businessKey, null))
            {
                query.processInstanceBusinessKey(businessKey);
            }

            string processInstanceId = correlationSet.ProcessInstanceId;

            if (!string.ReferenceEquals(processInstanceId, null))
            {
                query.processInstanceId(processInstanceId);
            }

            if (!string.ReferenceEquals(messageName, null))
            {
                query.messageEventSubscriptionName(messageName);
            }
            else
            {
                query.messageEventSubscription();
            }

            if (correlationSet.isTenantIdSet)
            {
                string tenantId = correlationSet.TenantId;
                if (!string.ReferenceEquals(tenantId, null))
                {
                    query.tenantIdIn(tenantId);
                }
                else
                {
                    query.withoutTenantId();
                }
            }

            // restrict to active executions
            query.active();

            IList <Execution> matchingExecutions = query.evaluateExpressionsAndExecuteList(commandContext, null);

            IList <CorrelationHandlerResult> result = new List <CorrelationHandlerResult>(matchingExecutions.Count);

            foreach (Execution matchingExecution in matchingExecutions)
            {
                CorrelationHandlerResult correlationResult = CorrelationHandlerResult.matchedExecution((ExecutionEntity)matchingExecution);
                if (!commandContext.DbEntityManager.isDeleted(correlationResult.ExecutionEntity))
                {
                    result.Add(correlationResult);
                }
            }

            return(result);
        }
Beispiel #4
0
 public virtual long findExecutionCountByQueryCriteria(ExecutionQueryImpl executionQuery)
 {
     configureQuery(executionQuery);
     return((long?)DbEntityManager.selectOne("selectExecutionCountByQueryCriteria", executionQuery).Value);
 }