예제 #1
0
 /// <summary>Fetches an existing vertex</summary>
 /// <seealso><a href="https://docs.arangodb.com/current/HTTP/Gharial/Vertices.html#get-a-vertex">API Documentation</a>
 ///     </seealso>
 /// <param name="key">The key of the vertex</param>
 /// <param name="type">The type of the vertex-document (POJO class, VPackSlice or String for Json)
 ///     </param>
 /// <param name="options">Additional options, can be null</param>
 /// <returns>the vertex identified by the key</returns>
 /// <exception cref="ArangoDBException"/>
 /// <exception cref="com.arangodb.ArangoDBException"/>
 public virtual T getVertex <T>(string key, DocumentReadOptions
                                options)
 {
     System.Type type = typeof(T);
     return(this.executor.execute(this.getVertexRequest(key, options), getVertexResponseDeserializer
                                      (type)));
 }
예제 #2
0
 /// <summary>Reads a single document</summary>
 /// <seealso><a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
 /// *      Documentation</a></seealso>
 /// <param name="id">The id of the document</param>
 /// <param name="type">The type of the document (POJO class, VPackSlice or String for Json)
 ///     </param>
 /// <param name="options">Additional options, can be null</param>
 /// <returns>the document identified by the id</returns>
 /// <exception cref="ArangoDBException"/>
 /// <exception cref="com.arangodb.ArangoDBException"/>
 public virtual T getDocument <T>(string id, DocumentReadOptions
                                  options)
 {
     System.Type type = typeof(T);
     executor.validateDocumentId(id);
     string[] split = id.split("/");
     return(this.collection(split[0]).getDocument(split[1], type, options));
 }
예제 #3
0
        protected internal virtual Request getVertexRequest(string
                                                            key, DocumentReadOptions options)
        {
            Request request = new Request
                                  (this.db, RequestType.GET, this.executor.createPath(ArangoDBConstants
                                                                                      .PATH_API_GHARIAL, this.graph, ArangoDBConstants.VERTEX, this.createDocumentHandle
                                                                                          (key)));
            DocumentReadOptions @params = options != null ? options : new
                                          DocumentReadOptions();

            request.putHeaderParam(ArangoDBConstants.IF_NONE_MATCH, @params
                                   .getIfNoneMatch());
            request.putHeaderParam(ArangoDBConstants.IF_MATCH, @params
                                   .getIfMatch());
            return(request);
        }
예제 #4
0
 /// <summary>Reads a single document</summary>
 /// <seealso><a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#read-document">API
 /// *      Documentation</a></seealso>
 /// <param name="key">The key of the document</param>
 /// <param name="type">The type of the document (POJO class, VPackSlice or String for Json)
 ///     </param>
 /// <param name="options">Additional options, can be null</param>
 /// <returns>the document identified by the key</returns>
 /// <exception cref="ArangoDBException"/>
 /// <exception cref="com.arangodb.ArangoDBException"/>
 public virtual T getDocument <T>(string key, DocumentReadOptions
                                  options)
 {
     System.Type type = typeof(T);
     this.executor.validateDocumentKey(key);
     try
     {
         return(this.executor.execute(this.getDocumentRequest(key, options), type));
     }
     catch (ArangoDBException e)
     {
         if (LOGGER.isDebugEnabled())
         {
             LOGGER.debug(e.Message, e);
         }
         return(null);
     }
 }