@@ -386,7 +386,11 @@ public <T> VertexEntity<T> createVertex(
386
386
result = new VertexEntity <T >();
387
387
result .setEntity (vertex );
388
388
} else {
389
- result = createEntity (res , VertexEntity .class , vertex .getClass ());
389
+ if (vertex != null ) {
390
+ result = createEntity (res , VertexEntity .class , vertex .getClass ());
391
+ } else {
392
+ result = createEntity (res , VertexEntity .class );
393
+ }
390
394
result .setEntity (vertex );
391
395
annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
392
396
result .getDocumentHandle (), result .getDocumentKey ());
@@ -425,8 +429,7 @@ public <T> VertexEntity<T> getVertex(
425
429
HttpResponseEntity res = httpManager .doGet (
426
430
createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
427
431
StringUtils .encodeUrl (collectionName ), StringUtils .encodeUrl (key )),
428
- new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true )
429
- .get (),
432
+ new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true ).get (),
430
433
new MapBuilder ().get ());
431
434
432
435
return createEntity (res , VertexEntity .class , clazz );
@@ -448,15 +451,17 @@ public <T> VertexEntity<T> replaceVertex(
448
451
HttpResponseEntity res = httpManager .doPut (
449
452
createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
450
453
StringUtils .encodeUrl (collectionName ), StringUtils .encodeUrl (key )),
451
- new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true )
452
- .get (),
454
+ new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true ).get (),
453
455
new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get (), EntityFactory .toJsonString (vertex ));
454
456
455
- VertexEntity <T > result = createEntity ( res , VertexEntity . class , vertex . getClass ()) ;
457
+ VertexEntity <T > result ;
456
458
if (vertex != null ) {
459
+ result = createEntity (res , VertexEntity .class , vertex .getClass ());
457
460
result .setEntity (vertex );
458
461
annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
459
462
result .getDocumentHandle (), result .getDocumentKey ());
463
+ } else {
464
+ result = createEntity (res , VertexEntity .class );
460
465
}
461
466
return result ;
462
467
}
@@ -478,16 +483,18 @@ public <T> VertexEntity<T> updateVertex(
478
483
HttpResponseEntity res = httpManager .doPatch (
479
484
createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
480
485
StringUtils .encodeUrl (collectionName ), StringUtils .encodeUrl (key )),
481
- new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true )
482
- .get (),
486
+ new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true ).get (),
483
487
new MapBuilder ().put ("keepNull" , keepNull ).put (WAIT_FOR_SYNC , waitForSync ).get (),
484
488
EntityFactory .toJsonString (vertex , keepNull != null && !keepNull ));
485
489
486
- VertexEntity <T > result = createEntity ( res , VertexEntity . class , vertex . getClass ()) ;
490
+ VertexEntity <T > result ;
487
491
if (vertex != null ) {
492
+ result = createEntity (res , VertexEntity .class , vertex .getClass ());
488
493
result .setEntity (vertex );
489
494
annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
490
495
result .getDocumentHandle (), result .getDocumentKey ());
496
+ } else {
497
+ result = createEntity (res , VertexEntity .class );
491
498
}
492
499
return result ;
493
500
}
@@ -506,8 +513,7 @@ public DeletedEntity deleteVertex(
506
513
HttpResponseEntity res = httpManager .doDelete (
507
514
createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
508
515
StringUtils .encodeUrl (collectionName ), StringUtils .encodeUrl (key )),
509
- new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true )
510
- .get (),
516
+ new MapBuilder ().put (IF_MATCH , ifMatchRevision , true ).put (IF_NONE_MATCH , ifNoneMatchRevision , true ).get (),
511
517
new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get ());
512
518
513
519
return createEntity (res , DeletedEntity .class );
@@ -575,8 +581,7 @@ public <T> EdgeEntity<T> getEdge(
575
581
HttpResponseEntity res = httpManager .doGet (
576
582
createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
577
583
StringUtils .encodeUrl (edgeCollectionName ), StringUtils .encodeUrl (key )),
578
- new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true )
579
- .get (),
584
+ new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true ).get (),
580
585
new MapBuilder ().get ());
581
586
582
587
return createEntity (res , EdgeEntity .class , clazz );
@@ -596,8 +601,7 @@ public DeletedEntity deleteEdge(
596
601
HttpResponseEntity res = httpManager .doDelete (
597
602
createEndpointUrl (database , "/_api/gharial" , StringUtils .encodeUrl (graphName ), EDGE ,
598
603
StringUtils .encodeUrl (edgeCollectionName ), StringUtils .encodeUrl (key )),
599
- new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true )
600
- .get (),
604
+ new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true ).get (),
601
605
new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get ());
602
606
603
607
return createEntity (res , DeletedEntity .class );
@@ -620,8 +624,7 @@ public <T> EdgeEntity<T> replaceEdge(
620
624
HttpResponseEntity res = httpManager .doPut (
621
625
createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
622
626
StringUtils .encodeUrl (edgeCollectionName ), StringUtils .encodeUrl (key )),
623
- new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true )
624
- .get (),
627
+ new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true ).get (),
625
628
new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get (),
626
629
value == null ? null : EntityFactory .toJsonString (value ));
627
630
@@ -651,8 +654,7 @@ public <T> EdgeEntity<T> updateEdge(
651
654
HttpResponseEntity res = httpManager .doPatch (
652
655
createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
653
656
StringUtils .encodeUrl (edgeCollectionName ), StringUtils .encodeUrl (key )),
654
- new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true )
655
- .get (),
657
+ new MapBuilder ().put (IF_NONE_MATCH , ifNoneMatchRevision , true ).put (IF_MATCH , ifMatchRevision , true ).get (),
656
658
new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).put ("keepNull" , keepNull ).get (),
657
659
value == null ? null : EntityFactory .toJsonString (value ));
658
660
0 commit comments