Beispiel #1
0
        public virtual void Validate(GQLPluginManager myPluginManager, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            if (myPluginManager.HasPlugin <IGQLFunction>(FuncName))
            {
                Function = myPluginManager.GetAndInitializePlugin <IGQLFunction>(FuncName);
            }
            else
            {
                throw new AggregateOrFunctionDoesNotExistException(FuncName);
            }

            #region parameter exceptions

            #region check number of parameters

            Boolean containsVariableNumOfParams = this.Function.GetParameters().Exists(p => p.VariableNumOfParams);

            if (this.Function.GetParameters().Count != Parameters.Count && (!containsVariableNumOfParams))
            {
                throw new FunctionParameterCountMismatchException(this.Function.PluginShortName, this.Function.GetParameters().Count, Parameters.Count);
            }
            else if (containsVariableNumOfParams && Parameters.Count == 0)
            {
                throw new FunctionParameterCountMismatchException(this.Function.PluginShortName, 1, Parameters.Count);
            }

            #endregion

            #endregion
        }
Beispiel #2
0
        public override void Validate(GQLPluginManager myPluginManager, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            if (!myPluginManager.HasPlugin <IGQLAggregate>(FuncName))
            {
                throw new AggregateOrFunctionDoesNotExistException(FuncName);
            }

            Aggregate = myPluginManager.GetAndInitializePlugin <IGQLAggregate>(FuncName);

            if (Parameters.Count != 1)
            {
                throw new AggregateParameterCountMismatchException(FuncName, 1, Parameters.Count);
            }

            _Parameter = Parameters.FirstOrDefault() as IDChainDefinition;
            if (_Parameter == null)
            {
                throw new AggregateNotAllowedException(this.FuncName);
            }

            _Parameter.Validate(myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, false);
        }