Exemplo n.º 1
0
 public override bool IsReadOnly(ELContext context, object @base, object property)
 {
     if (@base == null)
     {
         var variable = (string)property;
         var @object  = context.GetContext(typeof(IVariableScope));
         return((@object != null) && !((IVariableScope)@object).HasVariable(variable));
     }
     return(true);
 }
Exemplo n.º 2
0
 public override void SetValue(ELContext context, object @base, object property, object value)
 {
     if (@base == null)
     {
         var variable = (string)property;
         var @object  = context.GetContext(typeof(IVariableScope));
         if (@object != null)
         {
             var variableScope = (IVariableScope)@object;
             if (variableScope.HasVariable(variable))
             {
                 variableScope.SetVariable(variable, value);
             }
         }
     }
 }
Exemplo n.º 3
0
        public override object GetValue(ELContext context, object @base, object property)
        {
            var @object = context.GetContext(typeof(IVariableScope));

            if (@object != null)
            {
                var variableScope = (IVariableScope)@object;
                if (@base == null)
                {
                    var variable = (string)property; // according to javadoc, can only be a String

                    if ((ExecutionKey.Equals(property) && variableScope is ExecutionEntity) ||
                        (TaskKey.Equals(property) && variableScope is TaskEntity) ||
                        (/*variableScope is CaseExecutionEntity &&*/
                            (CaseExecutionKey.Equals(property) || ExecutionKey.Equals(property))))
                    {
                        context.PropertyResolved = true;
                        return(variableScope);
                    }
                    if (ExecutionKey.Equals(property) && variableScope is TaskEntity)
                    {
                        context.PropertyResolved = true;
                        return(((TaskEntity)variableScope).Execution);
                    }
                    if (LoggedInUserKey.Equals(property))
                    {
                        context.PropertyResolved = true;
                        return(Context.CommandContext.AuthenticatedUserId);
                    }
                    if (variableScope.HasVariable(variable))
                    {
                        context.PropertyResolved = 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);
        }
Exemplo n.º 4
0
        public override object GetValue(ELContext context, object @base, object property)
        {
            var variableContext = (IVariableContext)context.GetContext(typeof(IVariableContext));

            if (variableContext != null)
            {
                if (VarCtxKey.Equals(property))
                {
                    context.PropertyResolved = true;
                    return(variableContext);
                }
                var typedValue = variableContext.Resolve((string)property);
                if (typedValue != null)
                {
                    context.PropertyResolved = true;
                    return(Unpack(typedValue));
                }
            }
            return(null);
        }