Package org.neo4j.ogm.cypher.compiler
Class MultiStatementCypherCompiler
java.lang.Object
org.neo4j.ogm.cypher.compiler.MultiStatementCypherCompiler
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptioncontext()
Returns this compiler's contextList<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that create nodes built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that create relationships built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that delete relationship entities built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that delete relationships built up through thisCompiler
.existingNode
(Long existingNodeId) Returns aNodeBuilder
that represents a node that already exists in the database and matches the given ID.existingRelationship
(Long existingRelationshipId, Relationship.Direction direction, String type, boolean wasDirty) Returns aRelationshipBuilder
that represents and existing relationship entity to be modified in the databaseList<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that have been built up through thisCompiler
.boolean
Whether there new relationships to be created that depend on nodes being created firstReturnsNodeBuilder
that represents a new node to be created in the database.newRelationship
(String type) Returns aRelationshipBuilder
that represents a new relationship to be created in the databasenewRelationship
(String type, boolean bidirectional) Returns aRelationshipBuilder
that represents a new relationship to be created in the databasevoid
unmap
(NodeBuilder nodeBuilder) Remove aNodeBuilder
Defines a relationship deletion between the specified start node to end node with the given relationship type and direction.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that update nodes built up through thisCompiler
.List<org.neo4j.ogm.request.Statement>
Retrieves the Cypher statements that update relationships built up through thisCompiler
.void
useStatementFactory
(org.neo4j.ogm.request.StatementFactory newStatementFactory)
-
Constructor Details
-
MultiStatementCypherCompiler
-
-
Method Details
-
newNode
Description copied from interface:Compiler
ReturnsNodeBuilder
that represents a new node to be created in the database.- Specified by:
newNode
in interfaceCompiler
- Returns:
- A
NodeBuilder
representing a new node
-
newRelationship
Description copied from interface:Compiler
Returns aRelationshipBuilder
that represents a new relationship to be created in the database- Specified by:
newRelationship
in interfaceCompiler
- Parameters:
type
- the relationship typebidirectional
- true if the relationship must be created in both incoming and outgoing directions, false otherwise- Returns:
- A
RelationshipBuilder
representing a new relationship
-
newRelationship
Description copied from interface:Compiler
Returns aRelationshipBuilder
that represents a new relationship to be created in the database- Specified by:
newRelationship
in interfaceCompiler
- Parameters:
type
- the relationship type- Returns:
- A
RelationshipBuilder
representing a new relationship
-
existingNode
Description copied from interface:Compiler
Returns aNodeBuilder
that represents a node that already exists in the database and matches the given ID.- Specified by:
existingNode
in interfaceCompiler
- 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 aRelationshipBuilder
that represents and existing relationship entity to be modified in the database- Specified by:
existingRelationship
in interfaceCompiler
- Parameters:
existingRelationshipId
- The ID of the relationship in the database, which shouldn't benull
direction
- The direction of the existing relationshipwasDirty
- A flag if the relationship was in a dirty state- 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. -
unmap
Description copied from interface:Compiler
Remove aNodeBuilder
- Specified by:
unmap
in interfaceCompiler
- Parameters:
nodeBuilder
- TheNodeBuilder
-
createNodesStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that create nodes built up through thisCompiler
.- Specified by:
createNodesStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
createRelationshipsStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that create relationships built up through thisCompiler
.- Specified by:
createRelationshipsStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
updateNodesStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that update nodes built up through thisCompiler
.- Specified by:
updateNodesStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
updateRelationshipStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that update relationships built up through thisCompiler
.- Specified by:
updateRelationshipStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
deleteRelationshipStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that delete relationships built up through thisCompiler
.- Specified by:
deleteRelationshipStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
deleteRelationshipEntityStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that delete relationship entities built up through thisCompiler
.- Specified by:
deleteRelationshipEntityStatements
in interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
getAllStatements
Description copied from interface:Compiler
Retrieves the Cypher statements that have been built up through thisCompiler
.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 interfaceCompiler
- Returns:
- A
List
of Cypher queries to be executed or an empty list if there aren't any, nevernull
-
context
Description copied from interface:Compiler
Returns this compiler's 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 interfaceCompiler
- 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
- Specified by:
useStatementFactory
in interfaceCompiler
- Parameters:
newStatementFactory
- TheStatementFactory
-