Exemple #1
0
 public CallableAnonymousInnerClass(CorrelateAllMessageCmd outerInstance, CommandContext commandContext, CorrelationHandler correlationHandler, CorrelationSet correlationSet)
 {
     this.outerInstance      = outerInstance;
     this.commandContext     = commandContext;
     this.correlationHandler = correlationHandler;
     this.correlationSet     = correlationSet;
 }
Exemple #2
0
        public virtual IProcessInstance Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("messageName", MessageName);

            var correlationHandler = context.Impl.Context.ProcessEngineConfiguration.CorrelationHandler;
            var correlationSet     = new CorrelationSet(Builder);

            IList <CorrelationHandlerResult> correlationResults =
                commandContext.RunWithoutAuthorization(() => correlationHandler.CorrelateStartMessages(commandContext, MessageName, correlationSet));

            if (correlationResults.Count == 0)
            {
                throw new MismatchingMessageCorrelationException(MessageName,
                                                                 "No process definition matches the parameters");
            }
            if (correlationResults.Count > 1)
            {
                throw Log.ExceptionCorrelateMessageToSingleProcessDefinition(MessageName, correlationResults.Count,
                                                                             correlationSet);
            }
            var correlationResult = correlationResults[0];

            CheckAuthorization(correlationResult);

            var processInstance = InstantiateProcess(commandContext, correlationResult);

            return(processInstance);
        }
Exemple #3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public java.util.List<org.camunda.bpm.engine.impl.runtime.MessageCorrelationResultImpl> execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        public virtual IList <MessageCorrelationResultImpl> execute(CommandContext commandContext)
        {
            ensureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.BusinessKey, builder.CorrelationProcessInstanceVariables, builder.ProcessInstanceId);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationHandler correlationHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getCorrelationHandler();
            CorrelationHandler correlationHandler = Context.ProcessEngineConfiguration.CorrelationHandler;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationSet correlationSet = new org.camunda.bpm.engine.impl.runtime.CorrelationSet(builder);
            CorrelationSet correlationSet = new CorrelationSet(builder);
            IList <CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, correlationHandler, correlationSet));

            // check authorization
            foreach (CorrelationHandlerResult correlationResult in correlationResults)
            {
                checkAuthorization(correlationResult);
            }

            IList <MessageCorrelationResultImpl> results = new List <MessageCorrelationResultImpl>();

            foreach (CorrelationHandlerResult correlationResult in correlationResults)
            {
                results.Add(createMessageCorrelationResult(commandContext, correlationResult));
            }

            return(results);
        }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public org.camunda.bpm.engine.runtime.ProcessInstance execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        public virtual ProcessInstance execute(CommandContext commandContext)
        {
            ensureNotNull("messageName", messageName);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationHandler correlationHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getCorrelationHandler();
            CorrelationHandler correlationHandler = Context.ProcessEngineConfiguration.CorrelationHandler;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationSet correlationSet = new org.camunda.bpm.engine.impl.runtime.CorrelationSet(builder);
            CorrelationSet correlationSet = new CorrelationSet(builder);

            IList <CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, correlationHandler, correlationSet));

            if (correlationResults.Count == 0)
            {
                throw new MismatchingMessageCorrelationException(messageName, "No process definition matches the parameters");
            }
            else if (correlationResults.Count > 1)
            {
                throw LOG.exceptionCorrelateMessageToSingleProcessDefinition(messageName, correlationResults.Count, correlationSet);
            }
            else
            {
                CorrelationHandlerResult correlationResult = correlationResults[0];

                checkAuthorization(correlationResult);

                ProcessInstance processInstance = instantiateProcess(commandContext, correlationResult);
                return(processInstance);
            }
        }
Exemple #5
0
        public virtual IList <IMessageCorrelationResult> Execute(CommandContext commandContext)
        {
            //EnsureUtil.EnsureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: "
            //    + "messageName, businessKey, correlationKeys, processInstanceId",
            //    MessageName, Builder.BusinessKey, Builder.CorrelationProcessInstanceVariables, Builder.ProcessInstanceId);

            var correlationHandler = context.Impl.Context.ProcessEngineConfiguration.CorrelationHandler;
            var correlationSet     = new CorrelationSet(Builder);
            IList <CorrelationHandlerResult> correlationResults =
                commandContext.RunWithoutAuthorization(() => correlationHandler.CorrelateMessages(commandContext, MessageName, correlationSet));

            // check authorization
            foreach (var correlationResult in correlationResults)
            {
                CheckAuthorization(correlationResult);
            }

            IList <IMessageCorrelationResult> results = new List <IMessageCorrelationResult>();

            foreach (var correlationResult in correlationResults)
            {
                results.Add(CreateMessageCorrelationResult(commandContext, correlationResult));
            }

            return(null);
        }
Exemple #6
0
 public virtual MismatchingMessageCorrelationException ExceptionCorrelateMessageToSingleExecution(
     string messageName, long executionCound, CorrelationSet correlationSet)
 {
     return
         (new MismatchingMessageCorrelationException(ExceptionMessage("031",
                                                                      "Cannot correlate a message with name '{0}' to a single execution. {1} executions match the correlation keys: {2}",
                                                                      messageName, executionCound, correlationSet)));
 }
Exemple #7
0
 public virtual MismatchingMessageCorrelationException ExceptionCorrelateMessageToSingleProcessDefinition(
     string messageName, long processDefinitionCound, CorrelationSet correlationSet)
 {
     return
         (new MismatchingMessageCorrelationException(ExceptionMessage("030",
                                                                      "Cannot correlate a message with name '{0}' to a single process definition. {1} process definitions match the correlations keys: {2}",
                                                                      messageName, processDefinitionCound, correlationSet)));
 }
        /// <exception cref="XMLStreamException"></exception>
        private Collection <CorrelationSet> readCorrelationSets(XmlReader xmlReader)
        {
            Collection <CorrelationSet> correlationSets = new Collection <CorrelationSet>();
            bool finished = false;

            CorrelationSet correlationSet = null;

            while (!finished && xmlReader.MoveToNextAttribute())
            {
                //int Event = xmlReader.next();
                string name = XmlUtils.getElementQualifiedName(xmlReader, namespaces);

                switch (xmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    if ("config:correlated-client-set".Equals(name))
                    {
                        correlationSet = new CorrelationSet();
                    }
                    else if ("config:client-application-name".Equals(name))
                    {
                        correlationSet.getClientApplications().Add(xmlReader.ReadString().Trim());
                    }
                    else
                    {
                        /** unexpected start element **/
                    }
                    break;

                case XmlNodeType.EndElement:
                    if ("config:correlated-client-set".Equals(name))
                    {
                        correlationSets.Add(correlationSet);
                    }
                    else if ("config:correlation-config".Equals(name))
                    {
                        finished = true;
                    }
                    else
                    {
                        /** unexpected end element **/
                    }
                    break;

                default:
                    /** unused xml element - nothing to do **/
                    break;
                }
            }

            return(correlationSets);
        }
Exemple #9
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public org.camunda.bpm.engine.impl.runtime.MessageCorrelationResultImpl execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        public virtual MessageCorrelationResultImpl execute(CommandContext commandContext)
        {
            ensureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", messageName, builder.BusinessKey, builder.CorrelationProcessInstanceVariables, builder.ProcessInstanceId);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationHandler correlationHandler = org.camunda.bpm.engine.impl.context.Context.getProcessEngineConfiguration().getCorrelationHandler();
            CorrelationHandler correlationHandler = Context.ProcessEngineConfiguration.CorrelationHandler;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.runtime.CorrelationSet correlationSet = new org.camunda.bpm.engine.impl.runtime.CorrelationSet(builder);
            CorrelationSet correlationSet = new CorrelationSet(builder);

            CorrelationHandlerResult correlationResult = null;

            if (startMessageOnly)
            {
                IList <CorrelationHandlerResult> correlationResults = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, correlationHandler, correlationSet));
                if (correlationResults.Count == 0)
                {
                    throw new MismatchingMessageCorrelationException(messageName, "No process definition matches the parameters");
                }
                else if (correlationResults.Count > 1)
                {
                    throw LOG.exceptionCorrelateMessageToSingleProcessDefinition(messageName, correlationResults.Count, correlationSet);
                }
                else
                {
                    correlationResult = correlationResults[0];
                }
            }
            else
            {
                correlationResult = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass2(this, commandContext, correlationHandler, correlationSet));

                if (correlationResult == null)
                {
                    throw new MismatchingMessageCorrelationException(messageName, "No process definition or execution matches the parameters");
                }
            }

            // check authorization
            checkAuthorization(correlationResult);

            return(createMessageCorrelationResult(commandContext, correlationResult));
        }
Exemple #10
0
        public virtual IMessageCorrelationResult Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureAtLeastOneNotNull("At least one of the following correlation criteria has to be present: " + "messageName, businessKey, correlationKeys, processInstanceId", MessageName, Builder.BusinessKey, Builder.CorrelationProcessInstanceVariables, Builder.processInstanceId);

            var correlationHandler = context.Impl.Context.ProcessEngineConfiguration.CorrelationHandler;
            var correlationSet     = new CorrelationSet(Builder);
            CorrelationHandlerResult correlationResult =
                commandContext.RunWithoutAuthorization(() => correlationHandler.CorrelateMessage(commandContext, MessageName, correlationSet));

            if (correlationResult == null)
            {
                throw new MismatchingMessageCorrelationException(MessageName,
                                                                 "No process definition or execution matches the parameters");
            }

            // check authorization
            CheckAuthorization(correlationResult);

            return(CreateMessageCorrelationResult(commandContext, correlationResult));
        }