use of com.baidu.hugegraph.exception.InvalidResponseException in project incubator-hugegraph-toolchain by apache.
the class GraphsAPI method mode.
public GraphMode mode(String graph) {
RestResult result = this.client.get(joinPath(this.path(), graph), MODE);
@SuppressWarnings("unchecked") Map<String, String> mode = result.readObject(Map.class);
String value = mode.get(MODE);
if (value == null) {
throw new InvalidResponseException("Invalid response, expect 'mode' in response");
}
try {
return GraphMode.valueOf(value);
} catch (IllegalArgumentException e) {
throw new InvalidResponseException("Invalid GraphMode value '%s'", value);
}
}
use of com.baidu.hugegraph.exception.InvalidResponseException in project incubator-hugegraph-toolchain by apache.
the class GraphsAPI method readMode.
public GraphReadMode readMode(String graph) {
this.client.checkApiVersion("0.59", "graph read mode");
RestResult result = this.client.get(joinPath(this.path(), graph), GRAPH_READ_MODE);
@SuppressWarnings("unchecked") Map<String, String> readMode = result.readObject(Map.class);
String value = readMode.get(GRAPH_READ_MODE);
if (value == null) {
throw new InvalidResponseException("Invalid response, expect 'graph_read_mode' in response");
}
try {
return GraphReadMode.valueOf(value);
} catch (IllegalArgumentException e) {
throw new InvalidResponseException("Invalid GraphReadMode value '%s'", value);
}
}
use of com.baidu.hugegraph.exception.InvalidResponseException in project incubator-hugegraph-toolchain by apache.
the class VertexAPI method update.
public int update(BatchOlapPropertyRequest request) {
this.client.checkApiVersion("0.59", "olap property batch update");
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Encoding", BATCH_ENCODING);
String path = String.join("/", this.path(), "olap/batch");
RestResult result = this.client.put(path, null, request, headers);
Object size = result.readObject(Map.class).get("size");
if (!(size instanceof Integer)) {
throw new InvalidResponseException("The 'size' in response must be int, but got: %s(%s)", size, size.getClass());
}
return (int) size;
}
Aggregations