protected internal virtual IList <CorrelationHandlerResult> correlateStartMessageByEventSubscription(CommandContext commandContext, string messageName, CorrelationSet correlationSet) { IList <CorrelationHandlerResult> results = new List <CorrelationHandlerResult>(); DeploymentCache deploymentCache = commandContext.ProcessEngineConfiguration.DeploymentCache; IList <EventSubscriptionEntity> messageEventSubscriptions = findMessageStartEventSubscriptions(commandContext, messageName, correlationSet); foreach (EventSubscriptionEntity messageEventSubscription in messageEventSubscriptions) { if (!string.ReferenceEquals(messageEventSubscription.Configuration, null)) { string processDefinitionId = messageEventSubscription.Configuration; ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); // only an active process definition will be returned if (processDefinition != null && !processDefinition.Suspended) { CorrelationHandlerResult result = CorrelationHandlerResult.matchedProcessDefinition(processDefinition, messageEventSubscription.ActivityId); results.Add(result); } else { LOG.couldNotFindProcessDefinitionForEventSubscription(messageEventSubscription, processDefinitionId); } } } return(results); }
public virtual IList <CorrelationHandlerResult> correlateStartMessages(CommandContext commandContext, string messageName, CorrelationSet correlationSet) { if (string.ReferenceEquals(messageName, null)) { // ignore empty message name return(Collections.emptyList()); } if (string.ReferenceEquals(correlationSet.ProcessDefinitionId, null)) { return(correlateStartMessageByEventSubscription(commandContext, messageName, correlationSet)); } else { CorrelationHandlerResult correlationResult = correlateStartMessageByProcessDefinitionId(commandContext, messageName, correlationSet.ProcessDefinitionId); if (correlationResult != null) { return(Collections.singletonList(correlationResult)); } else { return(Collections.emptyList()); } } }
public static CorrelationHandlerResult matchedExecution(ExecutionEntity executionEntity) { CorrelationHandlerResult messageCorrelationResult = new CorrelationHandlerResult(); messageCorrelationResult.resultType = MessageCorrelationResultType.Execution; messageCorrelationResult.executionEntity = executionEntity; return(messageCorrelationResult); }
public static CorrelationHandlerResult matchedProcessDefinition(ProcessDefinitionEntity processDefinitionEntity, string startEventActivityId) { CorrelationHandlerResult messageCorrelationResult = new CorrelationHandlerResult(); messageCorrelationResult.processDefinitionEntity = processDefinitionEntity; messageCorrelationResult.startEventActivityId = startEventActivityId; messageCorrelationResult.resultType = MessageCorrelationResultType.ProcessDefinition; return(messageCorrelationResult); }
protected internal virtual CorrelationHandlerResult correlateStartMessageByProcessDefinitionId(CommandContext commandContext, string messageName, string processDefinitionId) { DeploymentCache deploymentCache = commandContext.ProcessEngineConfiguration.DeploymentCache; ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); // only an active process definition will be returned if (processDefinition != null && !processDefinition.Suspended) { string startActivityId = findStartActivityIdByMessage(processDefinition, messageName); if (!string.ReferenceEquals(startActivityId, null)) { return(CorrelationHandlerResult.matchedProcessDefinition(processDefinition, startActivityId)); } } return(null); }
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); }
public MessageCorrelationResultImpl(CorrelationHandlerResult handlerResult) { this.execution = handlerResult.Execution; this.resultType = handlerResult.ResultType; }