예제 #1
0
        // submit /////////////////////////////////////////////

        public virtual void handleSubmit(VariableScope variableScope, VariableMap values, VariableMap allValues)
        {
            TypedValue submittedValue = (TypedValue)values.getValueTyped(id);

            values.remove(id);

            // perform validation
            foreach (FormFieldValidationConstraintHandler validationHandler in validationHandlers)
            {
                object value = null;
                if (submittedValue != null)
                {
                    value = submittedValue.Value;
                }
                validationHandler.validate(value, allValues, this, variableScope);
            }

            // update variable(s)
            TypedValue modelValue = null;

            if (submittedValue != null)
            {
                if (type != null)
                {
                    modelValue = type.convertToModelValue(submittedValue);
                }
                else
                {
                    modelValue = submittedValue;
                }
            }
            else if (defaultValueExpression != null)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.variable.value.TypedValue expressionValue = org.camunda.bpm.engine.variable.Variables.untypedValue(defaultValueExpression.getValue(variableScope));
                TypedValue expressionValue = Variables.untypedValue(defaultValueExpression.getValue(variableScope));
                if (type != null)
                {
                    // first, need to convert to model value since the default value may be a String Constant specified in the model xml.
                    modelValue = type.convertToModelValue(Variables.untypedValue(expressionValue));
                }
                else if (expressionValue != null)
                {
                    modelValue = Variables.stringValue(expressionValue.Value.ToString());
                }
            }

            if (modelValue != null)
            {
                if (!string.ReferenceEquals(id, null))
                {
                    variableScope.setVariable(id, modelValue);
                }
            }
        }
예제 #2
0
 protected internal virtual VariableMap filterVariables(VariableMap variables)
 {
     if (variables != null)
     {
         foreach (string key in variablesFilter)
         {
             variables.remove(key);
         }
     }
     return(variables);
 }