Search in sources :

Example 36 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class GremlinJobAPI method execute.

public long execute(GremlinRequest request) {
    RestResult result = this.client.post(this.path(), request);
    @SuppressWarnings("unchecked") Map<String, Object> task = result.readObject(Map.class);
    return TaskAPI.parseTaskId(task);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 37 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class IndexLabelAPI method append.

public IndexLabel append(IndexLabel indexLabel) {
    if (this.client.apiVersionLt("0.50")) {
        throw new NotSupportException("action append on index label");
    }
    String id = indexLabel.name();
    Map<String, Object> params = ImmutableMap.of("action", "append");
    Object il = this.checkCreateOrUpdate(indexLabel);
    RestResult result = this.client.put(this.path(), id, il, params);
    return result.readObject(IndexLabel.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult) NotSupportException(com.baidu.hugegraph.exception.NotSupportException)

Example 38 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class IndexLabelAPI method eliminate.

public IndexLabel eliminate(IndexLabel indexLabel) {
    if (this.client.apiVersionLt("0.50")) {
        throw new NotSupportException("action eliminate on index label");
    }
    String id = indexLabel.name();
    Map<String, Object> params = ImmutableMap.of("action", "eliminate");
    Object il = this.checkCreateOrUpdate(indexLabel);
    RestResult result = this.client.put(this.path(), id, il, params);
    return result.readObject(IndexLabel.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult) NotSupportException(com.baidu.hugegraph.exception.NotSupportException)

Example 39 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class IndexLabelAPI method delete.

public long delete(String name) {
    RestResult result = this.client.delete(this.path(), name);
    @SuppressWarnings("unchecked") Map<String, Object> task = result.readObject(Map.class);
    return TaskAPI.parseTaskId(task);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 40 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class IndexLabelAPI method create.

public IndexLabel.IndexLabelWithTask create(IndexLabel indexLabel) {
    Object il = this.checkCreateOrUpdate(indexLabel);
    RestResult result = this.client.post(this.path(), il);
    return result.readObject(IndexLabel.IndexLabelWithTask.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult) IndexLabel(com.baidu.hugegraph.structure.schema.IndexLabel)

Aggregations

RestResult (com.baidu.hugegraph.rest.RestResult)132 Test (org.junit.Test)44 LinkedHashMap (java.util.LinkedHashMap)23 AbstractRestClient (com.baidu.hugegraph.rest.AbstractRestClient)19 RestClient (com.baidu.hugegraph.rest.RestClient)19 MultivaluedHashMap (jakarta.ws.rs.core.MultivaluedHashMap)12 Response (com.baidu.hugegraph.structure.gremlin.Response)6 Result (com.baidu.hugegraph.structure.gremlin.Result)6 PropertyKey (com.baidu.hugegraph.structure.schema.PropertyKey)6 Edge (com.baidu.hugegraph.structure.graph.Edge)5 Vertex (com.baidu.hugegraph.structure.graph.Vertex)5 Map (java.util.Map)5 IndexLabel (com.baidu.hugegraph.structure.schema.IndexLabel)4 InvalidResponseException (com.baidu.hugegraph.exception.InvalidResponseException)3 NotSupportException (com.baidu.hugegraph.exception.NotSupportException)3 EdgeLabel (com.baidu.hugegraph.structure.schema.EdgeLabel)3 VertexLabel (com.baidu.hugegraph.structure.schema.VertexLabel)3 ArrayList (java.util.ArrayList)3 NotAllCreatedException (com.baidu.hugegraph.exception.NotAllCreatedException)2 Project (com.baidu.hugegraph.structure.auth.Project)2