Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public virtual object Get(object key)
        {
            if (variableScopeKey.Equals(key))
            {
                return(variableScope);
            }
            else if (processEngineConfigurationKey.Equals(key))
            {
                return(processEngineConfiguration);
            }
            else if (runtimeServiceKey.Equals(key))
            {
                return(processEngineConfiguration.RuntimeService);
            }
            else if (taskServiceKey.Equals(key))
            {
                return(processEngineConfiguration.TaskService);
            }
            else if (repositoryServiceKey.Equals(key))
            {
                return(processEngineConfiguration.RepositoryService);
            }
            else if (managementServiceKey.Equals(key))
            {
                return(processEngineConfiguration.ManagementService);
            }

            return(variableScope.GetVariable((string)key));
        }
Ejemplo n.º 2
0
 public virtual object Get(object key)
 {
     if (variableScopeKey.Equals(key))
     {
         return(variableScope);
     }
     return(variableScope.GetVariable((string)key));
 }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="base"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public override object GetValue(ELContext context, object @base, object property)
        {
            string variable = property.ToString();

            if (@base == null)
            {
                if ((EXECUTION_KEY.Equals(variable) && variableScope is IExecutionEntity) || (TASK_KEY.Equals(variable) && variableScope is ITaskEntity))
                {
                    context.IsPropertyResolved = true;
                    return(variableScope);
                }
                else if (EXECUTION_KEY.Equals(variable) && variableScope is ITaskEntity entity)
                {
                    context.IsPropertyResolved = true;
                    return(entity.Execution);
                }
                else if (LOGGED_IN_USER_KEY.Equals(variable))
                {
                    context.IsPropertyResolved = true;
                    return(Authentication.AuthenticatedUser.Id);
                }
                else
                {
                    if (variableScope.HasVariable(variable))
                    {
                        context.IsPropertyResolved = true; // if not set, the next elResolver in the CompositeElResolver will be called
                        return(variableScope.GetVariable(variable));
                    }
                }
            }
            else
            {
                if (variableScope.HasVariable(variable))
                {
                    context.IsPropertyResolved = true; // if not set, the next elResolver in the CompositeElResolver will be called
                    return(variableScope.GetVariable(variable));
                }
            }

            // property resolution (eg. bean.value) will be done by the
            // BeanElResolver (part of the CompositeElResolver)
            // It will use the bean resolved in this resolver as base.

            return(null);
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 6
0
        public static string GetStringVariable(this IVariableScope transaction, string name)
        {
            var variable = transaction.GetVariable(name);

            if (variable == null)
            {
                return(null);
            }

            return(variable.Evaluate(null).AsVarChar());
        }
Ejemplo n.º 7
0
        public static bool GetBooleanVariable(this IVariableScope transaction, string name)
        {
            var variable = transaction.GetVariable(name);

            if (variable == null)
            {
                return(false);
            }

            return(variable.Evaluate(null).AsBoolean());
        }
Ejemplo n.º 8
0
        public static int GetIntegerVariable(this IVariableScope scope, string name, int defaultValue)
        {
            var variable = scope.GetVariable(name);

            if (variable == null)
            {
                return(defaultValue);
            }

            return(variable.Evaluate(null).AsInteger());
        }
Ejemplo n.º 9
0
        public static Variable SetVariable(this IVariableScope scope, string variableName, Field value)
        {
            var variable = scope.GetVariable(variableName);

            if (variable == null)
            {
                variable = scope.DefineVariable(variableName, value.Type);
            }

            variable.SetValue(value);
            return(variable);
        }
Ejemplo n.º 10
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));
        }
Ejemplo n.º 11
0
 public void MapOutputVariables(IDelegateExecution superExecution, IVariableScope subInstance)
 {
     superExecution.SetVariable("targetOrderId", subInstance.GetVariable("orderId"), "SubProcess_2");
 }