Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            string engineName     = (string)execution.getVariable("engineName");
            string processKeyName = (string)execution.getVariable("processKey");

            ENGINES[engineName].RuntimeService.startProcessInstanceByKey(processKeyName);
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                bool?transient1 = (bool?)execution.getVariable("transient1");
                bool?transient2 = (bool?)execution.getVariable("transient2");

                execution.setVariable(VARIABLE_NAME, Variables.integerValue(1, transient1));
                execution.setVariable(VARIABLE_NAME, Variables.integerValue(2, transient2));
            }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            if (execution.getVariable("listVar") != null)
            {
                execution.removeVariable("listVar");
                execution.setVariable("listVar", "stringValue");
            }
            else if (execution.getVariable("foo") != null)
            {
                execution.removeVariable("foo");
                execution.setVariable("foo", "secondValue");
            }
        }
Exemplo n.º 4
0
        protected internal virtual void throwExceptionIfRequested(DelegateExecution execution)
        {
            bool?shouldThrowException = (bool?)execution.getVariable(EXCEPTION_INDICATOR_VARIABLE);

            if (true.Equals(shouldThrowException))
            {
                string exceptionMessage = (string)execution.getVariable(EXCEPTION_MESSAGE_VARIABLE);
                if (string.ReferenceEquals(exceptionMessage, null))
                {
                    exceptionMessage = DEFAULT_EXCEPTION_MESSAGE;
                }

                throw new ThrowBpmnErrorDelegateException(exceptionMessage);
            }
        }
Exemplo n.º 5
0
        protected internal virtual void throwErrorIfRequested(DelegateExecution execution)
        {
            bool?shouldThrowError = (bool?)execution.getVariable(ERROR_INDICATOR_VARIABLE);

            if (true.Equals(shouldThrowError))
            {
                string errorName = (string)execution.getVariable(ERROR_NAME_VARIABLE);
                if (string.ReferenceEquals(errorName, null))
                {
                    errorName = DEFAULT_ERROR_NAME;
                }

                throw new BpmnError(errorName);
            }
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            IList <string> list = (IList <string>)execution.getVariable("listVar");

            // implicit update of the list, so no execution.setVariable call
            list.Add(NEW_ELEMENT);
        }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            string variableName = (string)variable.getValue(execution);
            string value        = (string)execution.getVariable(variableName);

            values.Add(value);
        }
Exemplo n.º 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            RuntimeService runtimeService = execution.ProcessEngineServices.RuntimeService;
            bool?          allFlag        = (bool?)execution.getVariable("allFlag");

            if (allFlag.Value)
            {
                // 1. message
                IDictionary <string, object> variablesFirstCall = new Dictionary <string, object>();
                variablesFirstCall["someVariable"] = "someValue1";
                runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesFirstCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateAllWithResult();

                // 2. message
                IDictionary <string, object> variablesSecondCall = new Dictionary <string, object>();
                variablesSecondCall["someVariable"] = "someValue2";
                runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesSecondCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateAllWithResult();
            }
            else
            {
                // 1. message
                IDictionary <string, object> variablesFirstCall = new Dictionary <string, object>();
                variablesFirstCall["someVariable"] = "someValue1";
                runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesFirstCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateWithResult();

                // 2. message
                IDictionary <string, object> variablesSecondCall = new Dictionary <string, object>();
                variablesSecondCall["someVariable"] = "someValue2";
                runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesSecondCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateWithResult();
            }
        }
Exemplo n.º 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            int?count = (int?)execution.getVariable("count");

            count = count + 1;
            Console.WriteLine("Count = " + count);
            execution.setVariable("count", count);
        }
Exemplo n.º 10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            if (!"23".Equals(execution.getVariable("serialnumber")))
            {
                throw new Exception("The provided router serial number is wrong. The correct serial number is 23 ;-)");
            }
            execution.setVariable("version", "2.0");
        }
Exemplo n.º 11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            DateTime currentTime = (DateTime)execution.getVariable("currentTime");

            currentTime           = DateUtils.addSeconds(currentTime, 1);
            ClockUtil.CurrentTime = currentTime;
            execution.setVariable("currentTime", currentTime);
        }
Exemplo n.º 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            IList <string> list = (IList <string>)execution.getVariable("listVar");

            execution.removeVariable("listVar");

            // implicitly update the previous list, should update the variable value
            list.Add(NEW_ELEMENT);
        }
Exemplo n.º 13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                businessProcess.setVariable("processName", "throwSignal-visited (was " + businessProcess.getVariable("processName") + ")");

                string signalProcessInstanceId = (string)execution.getVariable("signalProcessInstanceId");
                string executionId             = runtimeService.createExecutionQuery().processInstanceId(signalProcessInstanceId).signalEventSubscriptionName("alert").singleResult().Id;

                runtimeService.signalEventReceived("alert", executionId);
            }
Exemplo n.º 14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            string flight = (string)execution.getVariable("flight");

            if (!string.ReferenceEquals(flight, null))
            {
                canceledFlights.Add(flight);
            }
        }
Exemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                bool?fail = (bool?)execution.getVariable("fail");

                if (fail == null || fail == true)
                {
                    throw new ProcessEngineException(EXCEPTION_MESSAGE);
                }
            }
Exemplo n.º 16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            bool?shouldFail = (bool?)execution.getVariable("shouldFail");

            if (shouldFail != null && shouldFail)
            {
                throw new Exception("I fail as commanded");
            }
        }
Exemplo n.º 17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                Variable v = (Variable)execution.getVariable("variable");

                lock (typeof(ServiceTaskVariablesTest))
                {
                    // we expect this to be 'true' as well
                    isNullInDelegate3 = (!string.ReferenceEquals(v.value, null) && v.value.Equals("delegate2"));
                }
            }
Exemplo n.º 18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            IList <string> list = (IList <string>)execution.getVariable("listVar");

            // replace the list by another object
            execution.setVariable("listVar", new List <string>());

            // implicitly update the previous list, should update the variable value
            list.Add(NEW_ELEMENT);
        }
Exemplo n.º 19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            string version = (string)execution.getVariable("version");

            if ("1.0".Equals(version) || "2.0".Equals(version))
            {
                Console.WriteLine(" ### Updating router configuration...");
            }
            else
            {
                throw new Exception("Unsupported Version: " + version);
            }
        }
Exemplo n.º 20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            IList <string> list = (IList <string>)execution.getVariable("listVar");

            // implicitly update the previous list, should update the variable value
            list.Add(NEW_ELEMENT);

            // replace the list by another object
            execution.setVariable("listVar", new List <string>());

            // note that this is the condensed form of more realistic scenarios like
            // an implicit update in task 1 and an explicit update in the following task 2,
            // both in the same transaction.
        }
Exemplo n.º 21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            businessProcess.setVariable("processName", "throwSignal-visited (was " + businessProcess.getVariable("processName") + ")");

            string signalProcessInstanceId = (string)execution.getVariable("signalProcessInstanceId");
            string executionId             = runtimeService.createExecutionQuery().processInstanceId(signalProcessInstanceId).signalEventSubscriptionName("alert").singleResult().Id;

            CommandContext commandContext = Context.CommandContext;
            IList <EventSubscriptionEntity> findSignalEventSubscriptionsByEventName = commandContext.EventSubscriptionManager.findSignalEventSubscriptionsByNameAndExecution("alert", executionId);

            foreach (EventSubscriptionEntity signalEventSubscriptionEntity in findSignalEventSubscriptionsByEventName)
            {
                signalEventSubscriptionEntity.eventReceived(null, true);
            }
        }
Exemplo n.º 22
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                for (char i = 'a'; i < 'm'; i++)
                {
                    object value = execution.getVariable("" + i);
                    // variable 'j' is a transient null
                    if (i != 'j')
                    {
                        assertNotNull(value);
                    }
                    else
                    {
                        assertNull(value);
                    }
                }
            }
Exemplo n.º 23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void notify(org.camunda.bpm.engine.delegate.DelegateTask delegateTask)
        public virtual void notify(DelegateTask delegateTask)
        {
            // get mapping table from variable
            DelegateExecution            execution            = delegateTask.Execution;
            IDictionary <string, string> assigneeMappingTable = (IDictionary <string, string>)execution.getVariable("assigneeMappingTable");

            // get assignee from process
            string assigneeFromProcessDefinition = delegateTask.Assignee;

            // overwrite assignee if there is an entry in the mapping table
            if (assigneeMappingTable.ContainsKey(assigneeFromProcessDefinition))
            {
                string assigneeFromMappingTable = assigneeMappingTable[assigneeFromProcessDefinition];
                delegateTask.Assignee = assigneeFromMappingTable;
            }
        }
Exemplo n.º 24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void notify(DelegateExecution execution)
            {
                object variable = execution.getVariable(VARIABLE_NAME);

                assertNotNull(variable);
            }
Exemplo n.º 25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void execute(DelegateExecution execution)
            {
                execution.setVariable(VARIABLE_NAME, Variables.integerValue(1, true));
                execution.setVariable(VARIABLE_NAME, Variables.integerValue(OUTPUT_VALUE, true));
                execution.setVariable("transientVariableOutput", execution.getVariable(VARIABLE_NAME));
            }
Exemplo n.º 26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            JsonSerializable variable = (JsonSerializable)execution.getVariable(VARIABLE_NAME);

            addADay(variable);     // implicit update, i.e. no setVariable call
        }