Class MultiStatementCypherCompiler

java.lang.Object
org.neo4j.ogm.cypher.compiler.MultiStatementCypherCompiler
All Implemented Interfaces:
Compiler

public class MultiStatementCypherCompiler extends Object implements Compiler
Cypher compiler that produces multiple statements that can be executed together or split over a transaction.
Author:
Luanne Misquitta, Mark Angrish, Michael J. Simons
  • Constructor Details

    • MultiStatementCypherCompiler

      public MultiStatementCypherCompiler(Function<Object,Long> nativeIdProvider)
  • Method Details

    • newNode

      public NodeBuilder newNode(Long id)
      Description copied from interface: Compiler
      Returns NodeBuilder that represents a new node to be created in the database.
      Specified by:
      newNode in interface Compiler
      Returns:
      A NodeBuilder representing a new node
    • newRelationship

      public RelationshipBuilder newRelationship(String type, boolean bidirectional)
      Description copied from interface: Compiler
      Returns a RelationshipBuilder that represents a new relationship to be created in the database
      Specified by:
      newRelationship in interface Compiler
      Parameters:
      type - the relationship type
      bidirectional - true if the relationship must be created in both incoming and outgoing directions, false otherwise
      Returns:
      A RelationshipBuilder representing a new relationship
    • newRelationship

      public RelationshipBuilder newRelationship(String type)
      Description copied from interface: Compiler
      Returns a RelationshipBuilder that represents a new relationship to be created in the database
      Specified by:
      newRelationship in interface Compiler
      Parameters:
      type - the relationship type
      Returns:
      A RelationshipBuilder representing a new relationship
    • existingNode

      public NodeBuilder existingNode(Long existingNodeId)
      Description copied from interface: Compiler
      Returns a NodeBuilder that represents a node that already exists in the database and matches the given ID.
      Specified by:
      existingNode in interface Compiler
      Parameters:
      existingNodeId - The ID of the node in the database
      Returns:
      A NodeBuilder representing the node in the database that corresponds to the given ID
    • existingRelationship

      public RelationshipBuilder existingRelationship(Long existingRelationshipId, Relationship.Direction direction, String type, boolean wasDirty)
      Description copied from interface: Compiler
      Returns a RelationshipBuilder that represents and existing relationship entity to be modified in the database
      Specified by:
      existingRelationship in interface Compiler
      Parameters:
      existingRelationshipId - The ID of the relationship in the database, which shouldn't be null
      direction - The direction of the existing relationship
      Returns:
      A new RelationshipBuilder bound to the identified relationship entity
    • unrelate

      public RelationshipBuilder unrelate(Long startNode, String relationshipType, Long endNode, Long relId)
      Description copied from interface: Compiler
      Defines a relationship deletion between the specified start node to end node with the given relationship type and direction.
      Specified by:
      unrelate in interface Compiler
      Parameters:
      startNode - The reference of the relationship start node
      relationshipType - The type of relationship between the nodes to delete
      endNode - The reference of the relationship end node
      relId - The id of the relationship to unrelate
    • unmap

      public void unmap(NodeBuilder nodeBuilder)
      Description copied from interface: Compiler
      Remove a NodeBuilder
      Specified by:
      unmap in interface Compiler
      Parameters:
      nodeBuilder - The NodeBuilder
    • createNodesStatements

      public List<org.neo4j.ogm.request.Statement> createNodesStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that create nodes built up through this Compiler.
      Specified by:
      createNodesStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • createRelationshipsStatements

      public List<org.neo4j.ogm.request.Statement> createRelationshipsStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that create relationships built up through this Compiler.
      Specified by:
      createRelationshipsStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • updateNodesStatements

      public List<org.neo4j.ogm.request.Statement> updateNodesStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that update nodes built up through this Compiler.
      Specified by:
      updateNodesStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • updateRelationshipStatements

      public List<org.neo4j.ogm.request.Statement> updateRelationshipStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that update relationships built up through this Compiler.
      Specified by:
      updateRelationshipStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • deleteRelationshipStatements

      public List<org.neo4j.ogm.request.Statement> deleteRelationshipStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that delete relationships built up through this Compiler.
      Specified by:
      deleteRelationshipStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • deleteRelationshipEntityStatements

      public List<org.neo4j.ogm.request.Statement> deleteRelationshipEntityStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that delete relationship entities built up through this Compiler.
      Specified by:
      deleteRelationshipEntityStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • getAllStatements

      public List<org.neo4j.ogm.request.Statement> getAllStatements()
      Description copied from interface: Compiler
      Retrieves the Cypher statements that have been built up through this Compiler.

      Please node that there is no requirement that implementations of Compiler provide an idempotent or even deterministic implementation of this method. Therefore, it's recommended to only call this method once after all query building has been completed and to be aware that some statements may depend upon results of previous statements

      Specified by:
      getAllStatements in interface Compiler
      Returns:
      A List of Cypher queries to be executed or an empty list if there aren't any, never null
    • context

      public CompileContext context()
      Description copied from interface: Compiler
      Returns this compiler's context
      Specified by:
      context in interface Compiler
      Returns:
      the current compiler context
    • hasStatementsDependentOnNewNodes

      public boolean hasStatementsDependentOnNewNodes()
      Description copied from interface: Compiler
      Whether there new relationships to be created that depend on nodes being created first
      Specified by:
      hasStatementsDependentOnNewNodes in interface Compiler
      Returns:
      true if there are any statements that depend on new nodes being created first
    • useStatementFactory

      public void useStatementFactory(org.neo4j.ogm.request.StatementFactory newStatementFactory)
      Description copied from interface: Compiler
      Specify the StatementFactory that this Compiler will useto produce Statements
      Specified by:
      useStatementFactory in interface Compiler
      Parameters:
      newStatementFactory - The StatementFactory