Exemplo n.º 1
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)
        {
            EnsureUtil.ensureNotNull("user transaction", utx);

            // simulate a failure that triggers the transaction rollback
            utx.setRollbackOnly();
        }
Exemplo n.º 2
0
            public virtual void notify(DelegateTask delegateTask)
            {
                DelegateExecution execution   = delegateTask.Execution;
                string            newKeyValue = (string)execution.getVariable(BUSINESS_KEY_VARIABLE);

                execution.ProcessBusinessKey = newKeyValue;
            }
Exemplo n.º 3
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)
        {
            ProcessEngineServices processEngineServices = execution.ProcessEngineServices;
            RuntimeService        runtimeService        = processEngineServices.RuntimeService;

            runtimeService.getActivityInstance(execution.ProcessInstanceId);
        }
Exemplo n.º 4
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? executionsBeforeError = (int?)execution.getVariable("executionsBeforeError");
            int? executions            = (int?)execution.getVariable("executions");
            bool?exceptionType         = (bool?)execution.getVariable("exceptionType");

            if (executions == null)
            {
                executions = 0;
            }
            executions++;
            if (executionsBeforeError == null || executionsBeforeError < executions)
            {
                if (exceptionType != null && exceptionType)
                {
                    throw new MyBusinessException("This is a business exception, which can be caught by a BPMN Error Event.");
                }
                else
                {
                    throw new BpmnError("23", "This is a business fault, which can be caught by a BPMN Error Event.");
                }
            }
            else
            {
                execution.setVariable("executions", executions);
            }
        }
Exemplo n.º 5
0
        public virtual string assignTask(DelegateExecution execution)
        {
            logAuthentication(execution);
            logInstancesCount(execution);

            return("demo");
        }
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)
        {
            ProcessEngineServices services       = execution.ProcessEngineServices;
            RuntimeService        runtimeService = services.RuntimeService;

            runtimeService.setVariable(execution.Id, "serviceTaskCalled", true);
        }
Exemplo n.º 7
0
        public virtual void execute(DelegateExecution execution)
        {
            string var = (string)execution.getVariable(VARIABLE_NAME);

            var = var.ToUpper();
            execution.setVariable(VARIABLE_NAME, var);
        }
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)
        {
            JavaSerializable dataObject = (JavaSerializable)execution.getVariable("varName");

            Assert.assertNotNull(dataObject);
            Assert.assertEquals("foo", dataObject.Property);
        }
Exemplo n.º 9
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)
        {
            Task task = execution.ProcessEngineServices.TaskService.createTaskQuery().taskName(TASK_WITH_CONDITION).singleResult();

            ((TaskEntity)task).getExecution().setVariableLocal(VARIABLE_NAME, 1);
            execution.setVariableLocal(VARIABLE_NAME + 1, 1);
        }
Exemplo n.º 10
0
            public virtual void notify(DelegateTask delegateTask)
            {
                DelegateExecution execution = delegateTask.Execution;

                execution.setVariable("varName", "varValue", "activityId");
                assertThat(execution.getVariableLocal("varName"), @is(notNullValue()));
            }
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)
        {
            SerializableVariable serializableVariable = new SerializableVariable();

            serializableVariable.Value = "camunda BPM";

            execution.setVariable("var1", serializableVariable);
        }
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)
        {
            // first set variable to some string
            execution.setVariable("variableName", "test");

            // now set to serializable
            execution.setVariable("variableName", new SerializableVariable("foo"));
        }
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)
        {
            // we assert that the entity manager contains the entity
            // this means that we obtain the same entity manager we used to
            // persist the entity before starting the process

            Assert.assertTrue(em.contains(entity));
        }
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)
        {
            TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);

            transactionTemplate.PropagationBehavior = TransactionTemplate.PROPAGATION_REQUIRED;

            transactionTemplate.execute(new TransactionCallbackAnonymousInnerClass(this));
        }
Exemplo n.º 15
0
        public virtual bool evaluate(VariableScope scope, DelegateExecution execution)
        {
            object result = expression.getValue(scope, execution);

            ensureNotNull("condition expression returns null", "result", result);
            ensureInstanceOf("condition expression returns non-Boolean", "result", result, typeof(Boolean));
            return((bool?)result.Value);
        }
Exemplo n.º 16
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)
        {
            // we assert that the entity manager does not contain the entity
            // this means that we obtain a seperate entity manager since
            // we are invoked in a new transaction

            Assert.assertFalse(em.contains(entity));
        }
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)
        {
            execution.setVariable("myVar", sentenceGenerator.Sentence);
            if (someField != null)
            {
                execution.setVariable("fieldInjection", someField.getValue(execution));
            }
        }
Exemplo n.º 18
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)
        {
            execution.setVariable("executionListenerVar", "working");
            if (someField != null)
            {
                execution.setVariable("executionListenerField", someField.getValue(execution));
            }
        }
Exemplo 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)
        {
            RepositoryService repoService      = execution.ProcessEngineServices.RepositoryService;
            ProcessDefinition targetDefinition = repoService.createProcessDefinitionQuery().latestVersion().singleResult();

            SetProcessDefinitionVersionCmd migrationCommand = new SetProcessDefinitionVersionCmd(execution.ProcessInstanceId, targetDefinition.Version);

            Context.ProcessEngineConfiguration.CommandExecutorTxRequired.execute(migrationCommand);
        }
Exemplo 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)
        {
            bool?fail = (bool?)execution.getVariable("fail");

            if (fail != null && fail)
            {
                throw new ProcessEngineException("Exception expected.");
            }
        }
Exemplo n.º 21
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)
        {
            PerfTestRunContext perfTestRunContext = org.camunda.bpm.qa.performance.engine.framework.PerfTestRunContext_Fields.currentContext.get();

            if (perfTestRunContext != null)
            {
                perfTestRunContext.setVariable(EXECUTION_ID, execution.Id);
            }
        }
Exemplo n.º 22
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)
        {
            object shouldThrowError = execution.getVariable("shouldThrowError");

            if (shouldThrowError != null)
            {
                throw new BpmnError("error");
            }
        }
Exemplo n.º 23
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)
        {
            this.statefulObject.increment();

            Assert.assertNotNull("the 'scopedCustomer' reference can't be null", this.statefulObject);
            Assert.assertNotNull("the 'scopedCustomer.name' property should be non-null, since it was set in a previous delegate bound to this very thread", this.statefulObject.Name);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            log.info("the 'uuid' value retrieved from the ScopedCustomer#name property is '" + this.statefulObject.Name + "' in " + this.GetType().FullName);
        }
Exemplo 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)
        {
            bool?fail = (bool?)execution.getVariable("secondFail");

            if (fail == null || fail == true)
            {
                throw new ProcessEngineException(SECOND_EXCEPTION_MESSAGE);
            }
        }
Exemplo n.º 25
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)
        {
            int?counter = (int?)execution.getVariable("executionListenerCounter");

            if (counter == null)
            {
                counter = 0;
            }
            execution.setVariable("subExecutionListenerCounter", ++counter);
        }
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)
        {
            bool expressionWasExecuted         = (bool?)execution.getVariable("expressionWasExecuted").Value;
            bool delegateExpressionWasExecuted = (bool?)execution.getVariable("delegateExpressionWasExecuted").Value;
            bool wasExecuted = (bool?)execution.getVariable("wasExecuted").Value;

            this.expressionWasExecuted         = expressionWasExecuted;
            this.delegateExpressionWasExecuted = delegateExpressionWasExecuted;
            this.wasExecuted = wasExecuted;
        }
Exemplo n.º 27
0
        public virtual void execute(DelegateExecution execution)
        {
            execution.setVariable("jsonVariable", Variables.untypedValue(jsonValue("{}"), true));

            // when
            TypedValue typedValue = execution.getVariableTyped("jsonVariable");

            // then
            assertThat(typedValue.Transient, @is(true));
        }
Exemplo n.º 28
0
 protected internal override HistoryEvent createHistoryEvent(DelegateExecution execution)
 {
     if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_END, execution))
     {
         return(eventProducer.createProcessInstanceEndEvt(execution));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 29
0
 protected internal override HistoryEvent createHistoryEvent(DelegateExecution execution)
 {
     if (historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_START, execution))
     {
         return(eventProducer.createActivityInstanceStartEvt(execution));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 30
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 (instanceCount < 3)
            {
                execution.setVariable(AbstractConditionalEventTestCase.VARIABLE_NAME, 1);
            }
            else
            {
                execution.setVariable(AbstractConditionalEventTestCase.VARIABLE_NAME, instanceCount);
            }
        }