Search in sources :

Example 1 with ExistingRelationshipStatementBuilder

use of org.neo4j.ogm.cypher.compiler.builders.statement.ExistingRelationshipStatementBuilder in project neo4j-ogm by neo4j.

the class MultiStatementCypherCompiler method updateRelationshipStatements.

@Override
public List<Statement> updateRelationshipStatements() {
    assertStatementFactoryExists();
    if (existingRelationshipBuilders.isEmpty()) {
        return Collections.emptyList();
    }
    Map<Boolean, Set<Edge>> collect = existingRelationshipBuilders.values().stream().collect(partitioningBy(RelationshipBuilder::isDirty, Collectors.mapping(RelationshipBuilder::edge, Collectors.toSet())));
    List<Statement> result = new ArrayList<>();
    if (!collect.get(true).isEmpty()) {
        ExistingRelationshipStatementBuilder builder = new ExistingRelationshipStatementBuilder(collect.get(true), statementFactory, true);
        result.add(builder.build());
    }
    if (!collect.get(false).isEmpty()) {
        ExistingRelationshipStatementBuilder builder = new ExistingRelationshipStatementBuilder(collect.get(false), statementFactory, false);
        result.add(builder.build());
    }
    return result;
}
Also used : ExistingRelationshipStatementBuilder(org.neo4j.ogm.cypher.compiler.builders.statement.ExistingRelationshipStatementBuilder) Statement(org.neo4j.ogm.request.Statement) DefaultRelationshipBuilder(org.neo4j.ogm.cypher.compiler.builders.node.DefaultRelationshipBuilder)

Aggregations

DefaultRelationshipBuilder (org.neo4j.ogm.cypher.compiler.builders.node.DefaultRelationshipBuilder)1 ExistingRelationshipStatementBuilder (org.neo4j.ogm.cypher.compiler.builders.statement.ExistingRelationshipStatementBuilder)1 Statement (org.neo4j.ogm.request.Statement)1