Skip to content

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

@kerler

Description

@kerler

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions