Spring data gremlin makes it easier to implement Graph based repositories. This module extends Spring Data to allow support for potentially any Graph database that implements the Tinkerpop Blueprints 2.x API.
69
stars
54
forks
source link
Duplicated 'if (schema.isVertexSchema())' in SimpleGremlinRepository.java #45
In spring-data-gremlin/spring-data-gremlin-core/src/main/java/org/springframework/data/gremlin/repository/SimpleGremlinRepository.java::save(), there are duplicated 'if (schema.isVertexSchema())':
if (schema.isVertexSchema()) {
element = graph.getVertex(schema.decodeId(id));
} else if (schema.isVertexSchema()) {
@Transactional(readOnly = false)
public T save(Graph graph, T object) {
String id = schema.getObjectId(object);
if (StringUtils.isEmpty(id)) {
create(graph, object);
} else {
Element element;
if (schema.isVertexSchema()) {
element = graph.getVertex(schema.decodeId(id));
} else if (schema.isVertexSchema()) {
element = graph.getEdge(schema.decodeId(id));
} else {
throw new IllegalStateException("Schema is neither EDGE nor VERTEX!");
}
if (element == null) {
throw new IllegalStateException(String.format("Could not save %s with id %s, as it does not exist.", object, id));
}
schema.copyToGraph(graphAdapter, element, object);
}
return object;
}
In spring-data-gremlin/spring-data-gremlin-core/src/main/java/org/springframework/data/gremlin/repository/SimpleGremlinRepository.java::save(), there are duplicated 'if (schema.isVertexSchema())':
if (schema.isVertexSchema()) { element = graph.getVertex(schema.decodeId(id)); } else if (schema.isVertexSchema()) {
@Transactional(readOnly = false) public T save(Graph graph, T object) {