Esempio 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)
            {
                Variable v = new Variable();

                execution.setVariable("variable", v);
                v.value = "delegate1";
            }
Esempio n. 2
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)
        {
            foreach (DelegateExecutionAsserter a in asserts)
            {
                a.doAssert(execution);
            }
        }
Esempio 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)
        {
            string variableName = (string)variable.getValue(execution);
            string value        = (string)execution.getVariable(variableName);

            values.Add(value);
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
                public void notify(DelegateExecution execution)
                {
                    if ("miTasks#multiInstanceBody".Equals(execution.CurrentActivityId) && ([email protected]_Fields.EVENTNAME_START.Equals(execution.EventName) || [email protected]_Fields.EVENTNAME_END.Equals(execution.EventName)))
                    {
                        outerInstance.eventCountForMultiInstanceBody.incrementAndGet();
                    }
                }
Esempio n. 5
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);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void performNotification(final org.camunda.bpm.engine.delegate.DelegateExecution execution, java.util.concurrent.Callable<Void> notification) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        protected internal virtual void performNotification(DelegateExecution execution, Callable <Void> notification)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.application.ProcessApplicationReference processApp = org.camunda.bpm.engine.impl.context.ProcessApplicationContextUtil.getTargetProcessApplication((org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) execution);
            ProcessApplicationReference processApp = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity)execution);

            if (processApp == null)
            {
                // ignore silently
                LOG.noTargetProcessApplicationForExecution(execution);
            }
            else
            {
                if (ProcessApplicationContextUtil.requiresContextSwitch(processApp))
                {
                    // this should not be necessary since context switch is already performed by OperationContext and / or DelegateInterceptor
                    Context.executeWithinProcessApplication(notification, processApp, new InvocationContext(execution));
                }
                else
                {
                    // context switch already performed
                    notification.call();
                }
            }
        }
Esempio 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)
        {
            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();
            }
        }
Esempio n. 8
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)
        {
            long?    oneMinute = 1000L * 60L;
            DateTime shiftedTimeByOneMinute = new DateTime(ClockUtil.CurrentTime.Ticks + oneMinute);

            ClockUtil.CurrentTime = shiftedTimeByOneMinute;
        }
Esempio n. 9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void notify(DelegateExecution execution)
        {
            PvmExecutionImpl executionImpl = (PvmExecutionImpl)execution;

            LOG.debug("collecting event: " + execution.EventName + " on " + executionImpl.EventSource);
            events.Add(execution.EventName + " on " + executionImpl.EventSource);
        }
Esempio n. 10
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);
        }
Esempio 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)
            {
                serviceTaskInvokedCount++;

                // leave only 3 out of n subprocesses
                execution.setVariableLocal("terminate", serviceTaskInvokedCount > 3);
            }
Esempio n. 12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
                public void notify(DelegateExecution execution)
                {
                    if (!(((CoreExecution)execution).EventSource is ProcessDefinitionEntity))
                    {
                        outerInstance.eventCount.incrementAndGet();
                    }
                }
Esempio n. 13
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)
        {
            DateTime       now          = DateTime.Now;
            IList <string> serializable = new List <string>();

            serializable.Add("one");
            serializable.Add("two");
            serializable.Add("three");

            // Start process instance with different types of variables
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["shortVar"]   = (short)123;
            variables["integerVar"] = 1234;
            variables["longVar"]    = 928374L;

            variables["byteVar"] = new sbyte[] { 12, 32, 34 };

            variables["stringVar"]       = "coca-cola";
            variables["dateVar"]         = now;
            variables["nullVar"]         = null;
            variables["serializableVar"] = serializable;

            execution.VariablesLocal = variables;
        }
Esempio n. 14
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);
        }
Esempio 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?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));
            }
Esempio n. 16
0
            public void doAssert(DelegateExecution execution)
            {
                IdentityService identityService = execution.ProcessEngineServices.IdentityService;

                Authentication currentAuthentication = identityService.CurrentAuthentication;

                assertThat(currentAuthentication, @is(nullValue()));
            }
Esempio n. 17
0
 public virtual bool tryEvaluate(DelegateExecution execution)
 {
     if (condition != null)
     {
         return(condition.tryEvaluate(execution, execution));
     }
     throw new System.InvalidOperationException("Conditional event must have a condition!");
 }
Esempio n. 18
0
 public virtual void execute(DelegateExecution execution)
 {
     if (!setterInvoked)
     {
         throw new Exception("Setter was not invoked");
     }
     execution.setVariable("setterVar", ((string)text.getValue(execution)).ToUpper());
 }
Esempio n. 19
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);
        }
Esempio n. 20
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");
        }
Esempio n. 21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void notify(DelegateExecution execution)
        {
            if (shouldFail)
            {
                shouldFail = false;
                throw new Exception("I'm supposed to fail!");
            }
        }
Esempio 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)
        {
            string flight = (string)execution.getVariable("flight");

            if (!string.ReferenceEquals(flight, null))
            {
                canceledFlights.Add(flight);
            }
        }
Esempio n. 23
0
            public void doAssert(DelegateExecution execution)
            {
                IdentityService identityService = execution.ProcessEngineServices.IdentityService;

                Authentication currentAuthentication = identityService.CurrentAuthentication;

                assertThat(currentAuthentication, @is(notNullValue()));
                assertThat(currentAuthentication.TenantIds, hasItem(expectedTenantId));
            }
Esempio n. 24
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);
            }
Esempio n. 25
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);
        }
Esempio n. 26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
            public virtual void notify(DelegateExecution execution)
            {
                if (WaitingListener.monitor != null)
                {
                    ThreadControl localMonitor = WaitingListener.monitor;
                    WaitingListener.monitor = null;
                    localMonitor.sync();
                }
            }
Esempio n. 27
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;

            ObjectValue jsonSerializeable = Variables.objectValue(createJsonSerializable()).serializationDataFormat(Variables.SerializationDataFormats.JSON).create();

            // this should be executed in the context of the current process application
            runtimeService.setVariable(execution.ProcessInstanceId, VARIABLE_NAME, jsonSerializeable);
        }
Esempio n. 28
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");
            }
        }
Esempio n. 29
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);
                }
            }
Esempio n. 30
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        = values.GetEnumerator().next();

            execution.setVariableLocal(variableName, value);

            values.Remove(value);
        }