public virtual void SubmitFormVariables(IVariableMap properties, IVariableScope variableScope)
        {
            VariableMapImpl propertiesCopy = new VariableMapImpl(properties);

            // support legacy form properties
            foreach (var formPropertyHandler in FormPropertyHandlers)
            {
                formPropertyHandler.SubmitFormProperty(variableScope, propertiesCopy);
            }

            // support form data:
            foreach (var formFieldHandler in FormFieldHandlers)
            {
                formFieldHandler.HandleSubmit(variableScope, propertiesCopy, properties);
            }

            // any variables passed in which are not handled by form-fields or form
            // properties are added to the process as variables
            foreach (var propertyId in propertiesCopy.KeySet())
            {
                variableScope.SetVariable(propertyId, propertiesCopy.GetValueTyped <ITypedValue>(propertyId));
            }

            FireFormPropertyHistoryEvents(properties, variableScope);
        }
Exemple #2
0
        public virtual void Initialize(IVariableScope innerScopeInstance, IVariableScope outerScopeInstance)
        {
            if (!ReferenceEquals(sourceVariableName, null))
            {
                if (outerScopeInstance.HasVariable(sourceVariableName))
                {
                    var value = outerScopeInstance.GetVariable(sourceVariableName);
                    innerScopeInstance.SetVariable(destinationVariableName, value);
                }
                else
                {
                    throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName +
                                                     "', since the source variable '" + sourceVariableName +
                                                     "does not exist");
                }
            }

            if (sourceExpression != null)
            {
                var value = sourceExpression.GetValue(outerScopeInstance);
                innerScopeInstance.SetVariable(destinationVariableName, value);
            }

            if (!ReferenceEquals(link, null))
            {
                if (outerScopeInstance.HasVariable(sourceVariableName))
                {
                    var value = outerScopeInstance.GetVariable(sourceVariableName);
                    innerScopeInstance.SetVariable(destinationVariableName, value);
                }
                else
                {
                    throw new ProcessEngineException("Couldn't create variable '" + destinationVariableName +
                                                     "', since the source variable '" + sourceVariableName +
                                                     "does not exist");
                }
            }

            if (linkExpression != null)
            {
                var value = sourceExpression.GetValue(outerScopeInstance);
                innerScopeInstance.SetVariable(destinationVariableName, value);
            }
        }
Exemple #3
0
        public virtual void Destroy(IVariableScope innerScopeInstance, IVariableScope outerScopeInstance)
        {
            if (!ReferenceEquals(destinationVariableName, null))
            {
                if (innerScopeInstance.HasVariable(sourceVariableName))
                {
                    var value = innerScopeInstance.GetVariable(sourceVariableName);
                    outerScopeInstance.SetVariable(destinationVariableName, value);
                }
                else
                {
                    throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName +
                                                     ", since it does not exist");
                }
            }

            if (destinationExpression != null)
            {
                var value = destinationExpression.GetValue(innerScopeInstance);
                outerScopeInstance.SetVariable(destinationVariableName, value);
            }

            if (!ReferenceEquals(link, null))
            {
                if (innerScopeInstance.HasVariable(sourceVariableName))
                {
                    var value = innerScopeInstance.GetVariable(sourceVariableName);
                    outerScopeInstance.SetVariable(destinationVariableName, value);
                }
                else
                {
                    throw new ProcessEngineException("Couldn't destroy variable " + sourceVariableName +
                                                     ", since it does not exist");
                }
            }

            if (linkExpression != null)
            {
                var value = sourceExpression.GetValue(innerScopeInstance);
                outerScopeInstance.SetVariable(destinationVariableName, value);
            }
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="base"></param>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public override void SetValue(ELContext context, object @base, object property, object value)
 {
     if (@base == null)
     {
         string variable = property.ToString();
         if (variableScope.HasVariable(variable))
         {
             variableScope.SetVariable(variable, value);
         }
     }
 }
Exemple #5
0
        public virtual object Put(string name, object value)
        {
            if (autoStoreScriptVariables)
            {
                if (!UNSTORED_KEYS.Contains(name))
                {
                    object oldValue = variableScope.GetVariable(name);
                    variableScope.SetVariable(name, value);
                    return(oldValue);
                }
            }

            return(wrappedBindings.Put(name, value));
        }
Exemple #6
0
 public static void SetStringVariable(this IVariableScope transaction, string name, string value)
 {
     transaction.SetVariable(name, Field.String(value));
 }
Exemple #7
0
 public static void SetBooleanVariable(this IVariableScope transaction, string name, bool value)
 {
     transaction.SetVariable(name, Field.Boolean(value));
 }