示例#1
0
        protected internal virtual void initializeCommandWithVariables(CaseExecutionCommandBuilder commandBuilder, IDictionary <string, TriggerVariableValueDto> variables, string transition)
        {
            foreach (string variableName in variables.Keys)
            {
                try
                {
                    TriggerVariableValueDto variableValue = variables[variableName];
                    TypedValue typedValue = variableValue.toTypedValue(engine, objectMapper);

                    if (variableValue.Local)
                    {
                        commandBuilder.setVariableLocal(variableName, typedValue);
                    }
                    else
                    {
                        commandBuilder.setVariable(variableName, typedValue);
                    }
                }
                catch (RestException e)
                {
                    string errorMessage = string.Format("Cannot {0} case execution {1} due to invalid variable {2}: {3}", transition, caseExecutionId, variableName, e.Message);
                    throw new RestException(e.Status, e, errorMessage);
                }
            }
        }
示例#2
0
        protected internal virtual void applyVariables <T1>(ActivityInstantiationBuilder <T1> builder, ProcessEngine engine, ObjectMapper mapper)
        {
            if (variables != null)
            {
                foreach (KeyValuePair <string, TriggerVariableValueDto> variableValue in variables.SetOfKeyValuePairs())
                {
                    TriggerVariableValueDto value = variableValue.Value;

                    if (value.Local)
                    {
                        builder.setVariableLocal(variableValue.Key, value.toTypedValue(engine, mapper));
                    }
                    else
                    {
                        builder.setVariable(variableValue.Key, value.toTypedValue(engine, mapper));
                    }
                }
            }
        }