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)
        {
            execution.setVariableLocal("var", new SimpleSerializableBean());

            SimpleSerializableBean variable = (SimpleSerializableBean)execution.getVariable("var");

            variable.IntProperty = variable.IntProperty + 1;

            bool shouldExplicitlyUpdateVariable = (bool?)execution.getVariable("shouldExplicitlyUpdateVariable").Value;

            if (shouldExplicitlyUpdateVariable)
            {
                execution.setVariableLocal("var", variable);
            }
        }
Exemplo 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)
        {
            // validate integer variable
            int?expectedIntValue = 1234;

            assertEquals(expectedIntValue, execution.getVariable("anIntegerVariable"));
            assertEquals(expectedIntValue, execution.getVariableTyped("anIntegerVariable").Value);
            assertEquals(ValueType.INTEGER, execution.getVariableTyped("anIntegerVariable").Type);
            assertNull(execution.getVariableLocal("anIntegerVariable"));
            assertNull(execution.getVariableLocalTyped("anIntegerVariable"));

            // set an additional local variable
            execution.setVariableLocal("aStringVariable", "aStringValue");

            string expectedStringValue = "aStringValue";

            assertEquals(expectedStringValue, execution.getVariable("aStringVariable"));
            assertEquals(expectedStringValue, execution.getVariableTyped("aStringVariable").Value);
            assertEquals(ValueType.STRING, execution.getVariableTyped("aStringVariable").Type);
            assertEquals(expectedStringValue, execution.getVariableLocal("aStringVariable"));
            assertEquals(expectedStringValue, execution.getVariableLocalTyped("aStringVariable").Value);
            assertEquals(ValueType.STRING, execution.getVariableLocalTyped("aStringVariable").Type);

            SimpleSerializableBean objectValue = (SimpleSerializableBean)execution.getVariable("anObjectValue");

            assertNotNull(objectValue);
            assertEquals(10, objectValue.IntProperty);
            ObjectValue variableTyped = execution.getVariableTyped("anObjectValue");

            assertEquals(10, variableTyped.getValue(typeof(SimpleSerializableBean)).IntProperty);
            assertEquals(Variables.SerializationDataFormats.JAVA.Name, variableTyped.SerializationDataFormat);

            objectValue = (SimpleSerializableBean)execution.getVariable("anUntypedObjectValue");
            assertNotNull(objectValue);
            assertEquals(30, objectValue.IntProperty);
            variableTyped = execution.getVariableTyped("anUntypedObjectValue");
            assertEquals(30, variableTyped.getValue(typeof(SimpleSerializableBean)).IntProperty);
            assertEquals(Context.ProcessEngineConfiguration.DefaultSerializationFormat, variableTyped.SerializationDataFormat);
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            SimpleSerializableBean other = (SimpleSerializableBean)obj;

            if (intProperty != other.intProperty)
            {
                return(false);
            }
            return(true);
        }