Пример #1
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);
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #4
0
        public virtual bool HasVariable(string variableName)
        {
            if (HasVariableLocal(variableName))
            {
                return(true);
            }
            IVariableScope parentScope = ParentVariableScope;

            if (parentScope != null)
            {
                return(parentScope.HasVariable(variableName));
            }
            return(false);
        }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public virtual bool ContainsKey(object key)
 {
     return(variableScopeKey.Equals(key?.ToString()) || KEYS.Contains(key?.ToString()) || variableScope.HasVariable(key?.ToString()));
 }
Пример #6
0
 public virtual bool ContainsVariable(string variableName)
 {
     return(VariableScope.HasVariable(variableName));
 }
Пример #7
0
 public virtual bool ContainsKey(object key)
 {
     return(variableScopeKey.Equals(key) || variableScope.HasVariable((string)key));
 }