Esempio n. 1
0
 /// <summary>
 /// Creates a new pipelineable get edge type request
 /// </summary>
 /// <param name="myGetEdgeTypeRequest">The get edge type request</param>
 /// <param name="mySecurity">The security token of the request initiator</param>
 /// <param name="myTransactionToken">The transaction token</param>
 public PipelineableGetEdgeTypeRequest(RequestGetEdgeType myGetEdgeTypeRequest,
                                       SecurityToken mySecurity,
                                       Int64 myTransactionToken)
     : base(mySecurity, myTransactionToken)
 {
     _request = myGetEdgeTypeRequest;
 }
Esempio n. 2
0
        public override QueryResult GetResult(  GQLPluginManager myPluginManager,
            IGraphDB myGraphDB,
            SecurityToken mySecurityToken,
            Int64 myTransactionToken)
        {
            var resultingVertices = new List<IVertexView>();
            ASonesException error = null;

            if (!String.IsNullOrEmpty(_EdgeName))
            {

                #region Specific edge

                var request = new RequestGetEdgeType(_EdgeName);
                var edge = myGraphDB.GetEdgeType<IEdgeType>(mySecurityToken,
                                                            myTransactionToken,
                                                            request,
                                                            (stats, edgeType) => edgeType);

                if (edge != null)
                {
                    resultingVertices = new List<IVertexView>() { GenerateOutput(edge, _EdgeName) };
                }
                else
                {
                    error = new EdgeTypeDoesNotExistException(_EdgeName);
                }

                #endregion

            }
            else
            {

                #region All edges

                var resultingReadouts = new List<IVertexView>();

                var request = new RequestGetAllEdgeTypes();

                foreach (var edge in myGraphDB.GetAllEdgeTypes<IEnumerable<IEdgeType>>(mySecurityToken,
                                                                                        myTransactionToken,
                                                                                        request,
                                                                                        (stats, edgeTypes) => edgeTypes))
                {
                    resultingReadouts.Add(GenerateOutput(edge, edge.Name));
                }

                #endregion

            }

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

            if (!String.IsNullOrEmpty(_EdgeName))
            {

                #region Specific edge

                var request = new RequestGetEdgeType(_EdgeName);
                var edge = myGraphDB.GetEdgeType<IEdgeType>(mySecurityToken, 
                                                            myTransactionToken, 
                                                            request, 
                                                            (stats, edgeType) => edgeType);

                if (edge != null)
                {
                    resultingVertices = new List<IVertexView>() { GenerateOutput(edge, _EdgeName) };
                }
                else
                {
                    throw new EdgeTypeDoesNotExistException(_EdgeName);
                }

                #endregion

            }
            else
            {

                #region All edges

                var resultingReadouts = new List<IVertexView>();

                var request = new RequestGetAllEdgeTypes();

                foreach (var edge in myGraphDB.GetAllEdgeTypes<IEnumerable<IEdgeType>>(mySecurityToken,     
                                                                                        myTransactionToken, 
                                                                                        request, 
                                                                                        (stats, edgeTypes) => edgeTypes))
                {
                    resultingReadouts.Add(GenerateOutput(edge, edge.Name));
                }


                #endregion

            }

            return resultingVertices;
        }
Esempio n. 4
0
 public static RequestGetEdgeType MakeRequestGetEdgeType(String myEdgeTypeName, String myEdition = null)
 {
     RequestGetEdgeType Request = new RequestGetEdgeType(myEdgeTypeName, myEdition);
     return Request;
 }
Esempio n. 5
0
 public static RequestGetEdgeType MakeRequestGetEdgeType(Int64 myEdgeTypeID, String myEdition = null)
 {
     RequestGetEdgeType Request = new RequestGetEdgeType(myEdgeTypeID,myEdition);
     return Request;
 }
Esempio n. 6
0
        public TResult GetEdgeType <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, long myTransactionID, sones.GraphDB.Request.RequestGetEdgeType myRequestGetEdgeType, sones.GraphDB.Request.Converter.GetEdgeTypeResultConverter <TResult> myOutputconverter)
        {
            Stopwatch       RunningTime = Stopwatch.StartNew();
            ServiceEdgeType svcEdgeType;

            if (myRequestGetEdgeType.EdgeTypeName != null)
            {
                svcEdgeType = _GraphDSService.GetEdgeTypeByName(mySecurityToken, myTransactionID, myRequestGetEdgeType.EdgeTypeName, myRequestGetEdgeType.Edition);
            }
            else
            {
                svcEdgeType = _GraphDSService.GetEdgeTypeByID(mySecurityToken, myTransactionID, myRequestGetEdgeType.EdgeTypeID, myRequestGetEdgeType.Edition);
            }
            var edgeType = new RemoteEdgeType(svcEdgeType, this);

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