- public Edge addEdge(String type, Vertex source, Vertex target, Map<String, Object> properties, String txId)
- throws CrudException {
- // For now, assume source and target are straight ids...
- try {
-
- Optional<ChampObject> sourceObject = champApi.retrieveObject(Long.parseLong(source.getId().get()),
- Optional.of(getTransaction(txId)));
- if (!sourceObject.isPresent() || !sourceObject.get().getType().equals(source.getType())) {
- throw new CrudException(
- "Error creating edge - source vertex with id " + source + " does not exist in graph data base",
- javax.ws.rs.core.Response.Status.BAD_REQUEST);
- }
-
- Optional<ChampObject> targetObject = champApi.retrieveObject(Long.parseLong(target.getId().get()),
- Optional.of(getTransaction(txId)));
- if (!targetObject.isPresent() || !targetObject.get().getType().equals(target.getType())) {
- throw new CrudException(
- "Error creating edge - target vertex with id " + target + " does not exist in graph data base",
- javax.ws.rs.core.Response.Status.BAD_REQUEST);
- }
-
- // Now, create the ChampRelationship object for our edge and store it in
- // the graph database.
- return edgeFromChampRelationship(champApi.storeRelationship(
- new ChampRelationship.Builder(sourceObject.get(), targetObject.get(), type).properties(properties).build(),
- Optional.of(getTransaction(txId))));
-
- } catch (ChampMarshallingException | ChampObjectNotExistsException | ChampSchemaViolationException
- | ChampTransactionException | ChampRelationshipNotExistsException | ChampUnmarshallingException e) {
+ public void deleteVertex(String id, String type, String txId) throws CrudException {
+ String url = baseObjectUrl + "/" + id + "?transactionId=" + txId;
+ OperationResult getResult = client.delete(url, createHeader(), MediaType.APPLICATION_JSON_TYPE);