Ejemplo n.º 1
0
 public SelectionElementAggregate(IGQLAggregate myBaseAggregate, string myAlias, EdgeList myEdgeList, LevelKey myLevelKey, IDChainDefinition myRelatedIDChainDefinition, AggregateDefinition myAggregateDefinition)
 {
     Alias                    = myAlias;
     EdgeList                 = myEdgeList;
     LevelKey                 = myLevelKey;
     Aggregate                = myBaseAggregate;
     AggregateDefinition      = myAggregateDefinition;
     RelatedIDChainDefinition = myRelatedIDChainDefinition;
 }
Ejemplo n.º 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);
        }
        /// <summary>
        /// Generate an output for an aggregate description.
        /// </summary>
        /// <param name="myAggregate">The aggregate.</param>
        /// <param name="myAggrName">The aggregate name.</param>
        /// <returns>List of readouts with the information.</returns>
        private IVertexView GenerateOutput(IGQLAggregate myAggregate, String myAggrName)
        {
            var _Aggregate = new Dictionary <String, Object>();

            var temp  = new Dictionary <String, object>();
            var edges = new Dictionary <String, IEdgeView>();

            _Aggregate.Add("Aggregate", myAggregate.PluginShortName);
            _Aggregate.Add("Type", myAggrName);
            _Aggregate.Add("Description", myAggregate.PluginDescription);

            int count = 1;

            foreach (var parameter in ((IPluginable)myAggregate).SetableParameters)
            {
                temp.Add("Parameter " + count.ToString() + " Key: ", parameter.Key);

                count++;
            }

            edges.Add("SetableParameters", new SingleEdgeView(null, new VertexView(temp, null)));

            return(new VertexView(_Aggregate, edges));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Generate an output for an aggregate description.
        /// </summary>
        /// <param name="myAggregate">The aggregate.</param>
        /// <param name="myAggrName">The aggregate name.</param>
        /// <returns>List of readouts with the information.</returns>
        private IVertexView GenerateOutput(IGQLAggregate myAggregate, String myAggrName)
        {
            var _Aggregate = new Dictionary<String, Object>();

            var temp = new Dictionary<String, object>();
            var edges = new Dictionary<String, IEdgeView>();

            _Aggregate.Add("Aggregate", myAggregate.AggregateName);
            _Aggregate.Add("Type", myAggrName);
            _Aggregate.Add("Description", myAggregate.GetDescribeOutput());

            int count = 1;
            foreach (var parameter in ((IPluginable)myAggregate).SetableParameters)
            {
                temp.Add("Parameter " + count.ToString() + " Key: ", parameter.Key);

                count++;
            }

            edges.Add("SetableParameters", new SingleEdgeView(null, new VertexView(temp, null)));

            return new VertexView(_Aggregate, edges);
        }
Ejemplo n.º 5
0
 public SelectionElementAggregate(IGQLAggregate myBaseAggregate, string myAlias, EdgeList myEdgeList, LevelKey myLevelKey, IDChainDefinition myRelatedIDChainDefinition, AggregateDefinition myAggregateDefinition)
 {
     Alias = myAlias;
     EdgeList = myEdgeList;
     LevelKey = myLevelKey;
     Aggregate = myBaseAggregate;
     AggregateDefinition = myAggregateDefinition;
     RelatedIDChainDefinition = myRelatedIDChainDefinition;
 }