use of com.baidu.hugegraph.exception.NotAllCreatedException in project incubator-hugegraph-toolchain by apache.
the class EdgeAPI method create.
public List<String> create(List<Edge> edges, boolean checkVertex) {
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Encoding", BATCH_ENCODING);
Map<String, Object> params = ImmutableMap.of("check_vertex", checkVertex);
RestResult result = this.client.post(this.batchPath(), edges, headers, params);
List<String> ids = result.readList(String.class);
if (edges.size() != ids.size()) {
throw new NotAllCreatedException("Not all edges are successfully created, " + "expect '%s', the actual is '%s'", ids, edges.size(), ids.size());
}
return ids;
}
use of com.baidu.hugegraph.exception.NotAllCreatedException in project incubator-hugegraph-toolchain by apache.
the class VertexAPI method create.
public List<Object> create(List<Vertex> vertices) {
MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Encoding", BATCH_ENCODING);
RestResult result = this.client.post(this.batchPath(), vertices, headers);
List<Object> ids = result.readList(Object.class);
if (vertices.size() != ids.size()) {
throw new NotAllCreatedException("Not all vertices are successfully created, " + "expect '%s', the actual is '%s'", ids, vertices.size(), ids.size());
}
return ids;
}
Aggregations