Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public virtual void CollectVariables(VariableMapImpl resultVariables, ICollection <string> variableNames,
                                             bool isLocal, bool deserializeValues)
        {
            var collectAll = variableNames == null;

            var localVariables = VariableInstancesLocal;

            foreach (var var in localVariables)
            {
                if (!resultVariables.ContainsKey(var.Name) && (collectAll || variableNames.Contains(var.Name)))
                {
                    resultVariables.Put(@var.Name, @var.GetTypedValue(deserializeValues));
                }
            }
            if (!isLocal)
            {
                var parentScope = ParentVariableScope;
                // Do not propagate to parent if all variables in 'variableNames' are already collected!
                if ((parentScope != null) && (collectAll || !resultVariables.KeySet().Equals(variableNames)))
                {
                    parentScope.CollectVariables(resultVariables, variableNames, isLocal, deserializeValues);
                }
            }
        }