@@ -386,7 +386,11 @@ public <T> VertexEntity<T> createVertex(
386386 result = new VertexEntity <T >();
387387 result .setEntity (vertex );
388388 } 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+ }
390394 result .setEntity (vertex );
391395 annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
392396 result .getDocumentHandle (), result .getDocumentKey ());
@@ -425,8 +429,7 @@ public <T> VertexEntity<T> getVertex(
425429 HttpResponseEntity res = httpManager .doGet (
426430 createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
427431 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 (),
430433 new MapBuilder ().get ());
431434
432435 return createEntity (res , VertexEntity .class , clazz );
@@ -448,15 +451,17 @@ public <T> VertexEntity<T> replaceVertex(
448451 HttpResponseEntity res = httpManager .doPut (
449452 createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
450453 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 (),
453455 new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get (), EntityFactory .toJsonString (vertex ));
454456
455- VertexEntity <T > result = createEntity ( res , VertexEntity . class , vertex . getClass ()) ;
457+ VertexEntity <T > result ;
456458 if (vertex != null ) {
459+ result = createEntity (res , VertexEntity .class , vertex .getClass ());
457460 result .setEntity (vertex );
458461 annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
459462 result .getDocumentHandle (), result .getDocumentKey ());
463+ } else {
464+ result = createEntity (res , VertexEntity .class );
460465 }
461466 return result ;
462467 }
@@ -478,16 +483,18 @@ public <T> VertexEntity<T> updateVertex(
478483 HttpResponseEntity res = httpManager .doPatch (
479484 createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
480485 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 (),
483487 new MapBuilder ().put ("keepNull" , keepNull ).put (WAIT_FOR_SYNC , waitForSync ).get (),
484488 EntityFactory .toJsonString (vertex , keepNull != null && !keepNull ));
485489
486- VertexEntity <T > result = createEntity ( res , VertexEntity . class , vertex . getClass ()) ;
490+ VertexEntity <T > result ;
487491 if (vertex != null ) {
492+ result = createEntity (res , VertexEntity .class , vertex .getClass ());
488493 result .setEntity (vertex );
489494 annotationHandler .updateDocumentAttributes (result .getEntity (), result .getDocumentRevision (),
490495 result .getDocumentHandle (), result .getDocumentKey ());
496+ } else {
497+ result = createEntity (res , VertexEntity .class );
491498 }
492499 return result ;
493500 }
@@ -506,8 +513,7 @@ public DeletedEntity deleteVertex(
506513 HttpResponseEntity res = httpManager .doDelete (
507514 createGharialEndpointUrl (databaseName , StringUtils .encodeUrl (graphName ), VERTEX ,
508515 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 (),
511517 new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get ());
512518
513519 return createEntity (res , DeletedEntity .class );
@@ -575,8 +581,7 @@ public <T> EdgeEntity<T> getEdge(
575581 HttpResponseEntity res = httpManager .doGet (
576582 createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
577583 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 (),
580585 new MapBuilder ().get ());
581586
582587 return createEntity (res , EdgeEntity .class , clazz );
@@ -596,8 +601,7 @@ public DeletedEntity deleteEdge(
596601 HttpResponseEntity res = httpManager .doDelete (
597602 createEndpointUrl (database , "/_api/gharial" , StringUtils .encodeUrl (graphName ), EDGE ,
598603 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 (),
601605 new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get ());
602606
603607 return createEntity (res , DeletedEntity .class );
@@ -620,8 +624,7 @@ public <T> EdgeEntity<T> replaceEdge(
620624 HttpResponseEntity res = httpManager .doPut (
621625 createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
622626 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 (),
625628 new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).get (),
626629 value == null ? null : EntityFactory .toJsonString (value ));
627630
@@ -651,8 +654,7 @@ public <T> EdgeEntity<T> updateEdge(
651654 HttpResponseEntity res = httpManager .doPatch (
652655 createGharialEndpointUrl (database , StringUtils .encodeUrl (graphName ), EDGE ,
653656 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 (),
656658 new MapBuilder ().put (WAIT_FOR_SYNC , waitForSync ).put ("keepNull" , keepNull ).get (),
657659 value == null ? null : EntityFactory .toJsonString (value ));
658660
0 commit comments