/// <summary>
 /// Creates a new pipelineable get vertex type request
 /// </summary>
 /// <param name="myGetVertexTypeRequest">The get vertex type request</param>
 /// <param name="mySecurity">The security token of the request initiator</param>
 /// <param name="myTransactionToken">The transaction token</param>
 public PipelineableGetVertexTypeRequest(
     RequestGetVertexType myGetVertexTypeRequest,
     SecurityToken mySecurity,
     Int64 myTransactionToken)
     : base(mySecurity, myTransactionToken)
 {
     _request = myGetVertexTypeRequest;
 }
예제 #2
0
        /// <summary>
        /// <seealso cref=" ADescribeDefinition"/>
        /// </summary>
        public override QueryResult GetResult(GQLPluginManager myPluginManager,
            IGraphDB myGraphDB,
            SecurityToken mySecurityToken,
            TransactionToken myTransactionToken)
        {
            var resultingVertices = new List<IVertexView>();
            ASonesException error = null;

            if (!String.IsNullOrEmpty(_TypeName))
            {

                #region Specific type

                var request = new RequestGetVertexType(_TypeName);
                var type = myGraphDB.GetVertexType<IVertexType>(mySecurityToken, myTransactionToken, request, (stats, vertexType) => vertexType);

                if (type != null)
                {
                    resultingVertices = new List<IVertexView>() { (GenerateOutput(type, 1)) };
                }
                else
                {
                    error = new VertexTypeDoesNotExistException(_TypeName, "");
                }

                #endregion

            }
            else
            {

                #region All types

                foreach (var type in myGraphDB.GetAllVertexTypes<IEnumerable<IVertexType>>(mySecurityToken,
                                                                                            myTransactionToken,
                                                                                            new RequestGetAllVertexTypes(),
                                                                                            (stats, vertexTypes) => vertexTypes))
                {
                    resultingVertices.Add(GenerateOutput(type));
                }

                #endregion
            }

            if (error != null)
                return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Failed, resultingVertices, error);
            else
                return new QueryResult("", SonesGQLConstants.GQL, 0L, ResultType.Successful, resultingVertices);
        }
예제 #3
0
        /// <summary>
        /// <seealso cref=" ADescribeDefinition"/>
        /// </summary>
        public override IEnumerable<IVertexView> GetResult(GQLPluginManager myPluginManager,
                                                IGraphDB myGraphDB,
                                                SecurityToken mySecurityToken,
                                                Int64 myTransactionToken)
        {
            var resultingVertices = new List<IVertexView>();

            if (!String.IsNullOrEmpty(_TypeName))
            {

                #region Specific type

                var request = new RequestGetVertexType(_TypeName);
                var type = myGraphDB.GetVertexType<IVertexType>(mySecurityToken, myTransactionToken, request, (stats, vertexType) => vertexType);

                if (type != null)
                {
                    resultingVertices = new List<IVertexView>() { (GenerateOutput(type, 1)) };
                }
                else
                {
                    throw new VertexTypeDoesNotExistException(_TypeName, "");
                }

                #endregion

            }
            else
            {

                #region All types

                foreach (var type in myGraphDB.GetAllVertexTypes<IEnumerable<IVertexType>>(mySecurityToken,
                                                                                            myTransactionToken,
                                                                                            new RequestGetAllVertexTypes(),
                                                                                            (stats, vertexTypes) => vertexTypes))
                {
                    resultingVertices.Add(GenerateOutput(type));
                }

                #endregion
            }

            return resultingVertices;
        }
예제 #4
0
 public static RequestGetVertexType MakeRequestGetVertexType(Int64 myVertexTypeID)
 {
     RequestGetVertexType Request = new RequestGetVertexType(myVertexTypeID);
     return Request;
 }
예제 #5
0
 public static RequestGetVertexType MakeRequestGetVertexType(String myVertexTypeName)
 {
     RequestGetVertexType Request = new RequestGetVertexType(myVertexTypeName);
     return Request;
 }
예제 #6
0
        public TResult GetVertexType <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, long myTransactionID, sones.GraphDB.Request.RequestGetVertexType myRequestGetVertexType, sones.GraphDB.Request.Converter.GetVertexTypeResultConverter <TResult> myOutputconverter)
        {
            Stopwatch         RunningTime = Stopwatch.StartNew();
            ServiceVertexType svcVertexType;

            if (myRequestGetVertexType.VertexTypeName != null)
            {
                svcVertexType = _GraphDSService.GetVertexTypeByName(mySecurityToken, myTransactionID, myRequestGetVertexType.VertexTypeName);
            }
            else
            {
                svcVertexType = _GraphDSService.GetVertexTypeByID(mySecurityToken, myTransactionID, myRequestGetVertexType.VertexTypeID);
            }
            var vertexType = new RemoteVertexType(svcVertexType, this);

            RunningTime.Stop();
            return(myOutputconverter(new RequestStatistics(new TimeSpan(RunningTime.ElapsedTicks)), vertexType));
        }