Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated 'if (schema.isVertexSchema())' in SimpleGremlinRepository.java #45

Open
kerler opened this issue Apr 13, 2016 · 0 comments
Open

Comments

@kerler
Copy link

kerler commented Apr 13, 2016

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant