Example #1
0
        public virtual void destroy(VariableScope innerScopeInstance, VariableScope outerScopeInstance)
        {
            if (!string.ReferenceEquals(destinationVariableName, null))
            {
                if (innerScopeInstance.hasVariable(sourceVariableName))
                {
                    object 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)
            {
                object value = destinationExpression.getValue(innerScopeInstance);
                outerScopeInstance.setVariable(destinationVariableName, value);
            }

            if (!string.ReferenceEquals(link, null))
            {
                if (innerScopeInstance.hasVariable(sourceVariableName))
                {
                    object 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)
            {
                object value = sourceExpression.getValue(innerScopeInstance);
                outerScopeInstance.setVariable(destinationVariableName, value);
            }
        }
Example #2
0
        public virtual void initialize(VariableScope innerScopeInstance, VariableScope outerScopeInstance)
        {
            if (!string.ReferenceEquals(sourceVariableName, null))
            {
                if (outerScopeInstance.hasVariable(sourceVariableName))
                {
                    object 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)
            {
                object value = sourceExpression.getValue(outerScopeInstance);
                innerScopeInstance.setVariable(destinationVariableName, value);
            }

            if (!string.ReferenceEquals(link, null))
            {
                if (outerScopeInstance.hasVariable(sourceVariableName))
                {
                    object 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)
            {
                object value = sourceExpression.getValue(outerScopeInstance);
                innerScopeInstance.setVariable(destinationVariableName, value);
            }
        }
Example #3
0
 public override void setValue(ELContext context, object @base, object property, object value)
 {
     if (@base == null)
     {
         string variable = (string)property;
         object @object  = context.getContext(typeof(VariableScope));
         if (@object != null)
         {
             VariableScope variableScope = (VariableScope)@object;
             if (variableScope.hasVariable(variable))
             {
                 variableScope.setVariable(variable, value);
             }
         }
     }
 }
Example #4
0
        public override object getValue(ELContext context, object @base, object property)
        {
            object @object = context.getContext(typeof(VariableScope));

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

                    if ((EXECUTION_KEY.Equals(property) && variableScope is ExecutionEntity) || (TASK_KEY.Equals(property) && variableScope is TaskEntity) || (variableScope is CaseExecutionEntity && (CASE_EXECUTION_KEY.Equals(property) || EXECUTION_KEY.Equals(property))))
                    {
                        context.PropertyResolved = true;
                        return(variableScope);
                    }
                    else if (EXECUTION_KEY.Equals(property) && variableScope is TaskEntity)
                    {
                        context.PropertyResolved = true;
                        return(((TaskEntity)variableScope).getExecution());
                    }
                    else if (LOGGED_IN_USER_KEY.Equals(property))
                    {
                        context.PropertyResolved = true;
                        return(Context.CommandContext.AuthenticatedUserId);
                    }
                    else
                    {
                        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);
        }
Example #5
0
 public virtual bool containsVariable(string variableName)
 {
     return(variableScope.hasVariable(variableName));
 }
Example #6
0
 public virtual bool containsKey(object key)
 {
     return(variableScopeKey.Equals(key) || variableScope.hasVariable((string)key));
 }