2323
2424import org .apache .hugegraph .client .RestClient ;
2525import org .apache .hugegraph .exception .NotAllCreatedException ;
26+ import org .apache .hugegraph .rest .RestHeaders ;
2627import org .apache .hugegraph .rest .RestResult ;
2728import org .apache .hugegraph .structure .constant .Direction ;
2829import org .apache .hugegraph .structure .constant .HugeType ;
3233
3334import com .google .common .collect .ImmutableMap ;
3435
35- import jakarta .ws .rs .core .MultivaluedHashMap ;
36-
3736public class EdgeAPI extends GraphAPI {
3837
3938 public EdgeAPI (RestClient client , String graph ) {
@@ -51,12 +50,9 @@ public Edge create(Edge edge) {
5150 }
5251
5352 public List <String > create (List <Edge > edges , boolean checkVertex ) {
54- MultivaluedHashMap <String , Object > headers = new MultivaluedHashMap <>();
55- headers .putSingle ("Content-Encoding" , BATCH_ENCODING );
56- Map <String , Object > params = ImmutableMap .of ("check_vertex" ,
57- checkVertex );
58- RestResult result = this .client .post (this .batchPath (), edges ,
59- headers , params );
53+ RestHeaders headers = new RestHeaders ().add (RestHeaders .CONTENT_ENCODING , BATCH_ENCODING );
54+ Map <String , Object > params = ImmutableMap .of ("check_vertex" , checkVertex );
55+ RestResult result = this .client .post (this .batchPath (), edges , headers , params );
6056 List <String > ids = result .readList (String .class );
6157 if (edges .size () != ids .size ()) {
6258 throw new NotAllCreatedException ("Not all edges are successfully created, " +
@@ -68,10 +64,8 @@ public List<String> create(List<Edge> edges, boolean checkVertex) {
6864
6965 public List <Edge > update (BatchEdgeRequest request ) {
7066 this .client .checkApiVersion ("0.45" , "batch property update" );
71- MultivaluedHashMap <String , Object > headers = new MultivaluedHashMap <>();
72- headers .putSingle ("Content-Encoding" , BATCH_ENCODING );
73- RestResult result = this .client .put (this .batchPath (), null ,
74- request , headers );
67+ RestHeaders headers = new RestHeaders ().add (RestHeaders .CONTENT_ENCODING , BATCH_ENCODING );
68+ RestResult result = this .client .put (this .batchPath (), null , request , headers );
7569 return result .readList (this .type (), Edge .class );
7670 }
7771
@@ -98,11 +92,9 @@ public Edges list(int limit) {
9892 return this .list (null , null , null , null , 0 , null , limit );
9993 }
10094
101- public Edges list (Object vertexId , Direction direction ,
102- String label , Map <String , Object > properties ,
103- int offset , String page , int limit ) {
104- return this .list (vertexId , direction , label , properties , false ,
105- offset , page , limit );
95+ public Edges list (Object vertexId , Direction direction , String label ,
96+ Map <String , Object > properties , int offset , String page , int limit ) {
97+ return this .list (vertexId , direction , label , properties , false , offset , page , limit );
10698 }
10799
108100 public Edges list (Object vertexId , Direction direction , String label ,
0 commit comments