Package org.neo4j.ogm.cypher.compiler
Class CypherContext
java.lang.Object
org.neo4j.ogm.cypher.compiler.CypherContext
- All Implemented Interfaces:
CompileContext
Maintains contextual information throughout the process of compiling Cypher statements to persist a graph of objects.
- Author:
- Mark Angrish, Vince Bickers, Luanne Misquitta, Andreas Berger, Michael J. Simons
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deregister
(NodeBuilder nodeBuilder) boolean
deregisterIncomingRelationships
(Long tgt, String relationshipType, Class endNodeType, boolean relationshipEntity) Invoked when the mapper wishes to mark a set of incoming relationships to a specific type like (a)<-[:T]-(*) as deleted, prior to possibly re-establishing them individually as it traverses the entity graph.boolean
deregisterOutgoingRelationships
(Long src, String relationshipType, Class endNodeType) Invoked when the mapper wishes to mark a set of outgoing relationships to a specific type like (a)-[:T]->(*) as deleted, prior to possibly re-establishing them individually as it traverses the entity graph.getNewObject
(Long id) getTransientRelationships
(org.neo4j.ogm.compiler.SrcTargetKey srcTargetKey) getVisitedObject
(Long reference) void
void
registerNewId
(Long reference, Long id) void
registerNewObject
(Long reference, Object entity) void
registerRelationship
(Mappable mappedRelationship) void
registerTransientRelationship
(org.neo4j.ogm.compiler.SrcTargetKey key, Object object) registry()
boolean
removeRegisteredRelationship
(Mappable mappedRelationship) void
visit
(Object entity, NodeBuilder nodeBuilder, int horizon) Stores nodeBuilder for given entity with horizon if the nodeBuilder for the entity is already present it will be overwritten (or the horizon will change) the caller should ensure it doesn't happenboolean
visitedNode
(Object entity) boolean
visitedRelationshipEntity
(Long relationshipEntity) void
visitRelationshipEntity
(Long relationshipEntity)
-
Constructor Details
-
CypherContext
-
-
Method Details
-
visited
- Specified by:
visited
in interfaceCompileContext
-
visit
Description copied from interface:CompileContext
Stores nodeBuilder for given entity with horizon if the nodeBuilder for the entity is already present it will be overwritten (or the horizon will change) the caller should ensure it doesn't happen- Specified by:
visit
in interfaceCompileContext
-
registerRelationship
- Specified by:
registerRelationship
in interfaceCompileContext
-
removeRegisteredRelationship
- Specified by:
removeRegisteredRelationship
in interfaceCompileContext
-
visitedNode
- Specified by:
visitedNode
in interfaceCompileContext
-
registerNewObject
- Specified by:
registerNewObject
in interfaceCompileContext
-
getNewObject
- Specified by:
getNewObject
in interfaceCompileContext
-
register
- Specified by:
register
in interfaceCompileContext
-
registerTransientRelationship
- Specified by:
registerTransientRelationship
in interfaceCompileContext
-
registry
- Specified by:
registry
in interfaceCompileContext
-
deregisterOutgoingRelationships
public boolean deregisterOutgoingRelationships(Long src, String relationshipType, Class endNodeType) Invoked when the mapper wishes to mark a set of outgoing relationships to a specific type like (a)-[:T]->(*) as deleted, prior to possibly re-establishing them individually as it traverses the entity graph. There are two reasons why a set of relationships might not be be able to be marked deleted: 1) the request to mark them as deleted has already been made 2) the relationship is not persisted in the graph (i.e. its a new relationship) Only case 1) is considered to be a failed request, because this context is only concerned about pre-existing relationships in the graph. In order to distinguish between the two cases, we also maintain a list of successfully deleted relationships, so that if we try to delete an already-deleted set of relationships we can signal the error and undelete it.- Specified by:
deregisterOutgoingRelationships
in interfaceCompileContext
- Parameters:
src
- the identity of the node at the start of the relationshiprelationshipType
- the type of the relationshipendNodeType
- the class type of the entity at the end of the relationship- Returns:
- true if the relationship was deleted or doesn't exist in the graph, false otherwise
-
deregisterIncomingRelationships
public boolean deregisterIncomingRelationships(Long tgt, String relationshipType, Class endNodeType, boolean relationshipEntity) Invoked when the mapper wishes to mark a set of incoming relationships to a specific type like (a)<-[:T]-(*) as deleted, prior to possibly re-establishing them individually as it traverses the entity graph. There are two reasons why a set of relationships might not be be able to be marked deleted: 1) the request to mark them as deleted has already been made 2) the relationship is not persisted in the graph (i.e. its a new relationship) Only case 1) is considered to be a failed request, because this context is only concerned about pre-existing relationships in the graph. In order to distinguish between the two cases, we also maintain a list of successfully deleted relationships, so that ff we try to delete an already-deleted set of relationships we can signal the error and undelete it.- Specified by:
deregisterIncomingRelationships
in interfaceCompileContext
- Parameters:
tgt
- the identity of the node at the pointy end of the relationshiprelationshipType
- the type of the relationshipendNodeType
- the class type of the entity at the other end of the relationship- Returns:
- true if the relationship was deleted or doesn't exist in the graph, false otherwise
-
visitRelationshipEntity
- Specified by:
visitRelationshipEntity
in interfaceCompileContext
-
visitedRelationshipEntity
- Specified by:
visitedRelationshipEntity
in interfaceCompileContext
-
getCompiler
- Specified by:
getCompiler
in interfaceCompileContext
-
getId
- Specified by:
getId
in interfaceCompileContext
-
registerNewId
- Specified by:
registerNewId
in interfaceCompileContext
-
deregister
- Specified by:
deregister
in interfaceCompileContext
-
getDeletedRelationships
- Specified by:
getDeletedRelationships
in interfaceCompileContext
-
getVisitedObject
- Specified by:
getVisitedObject
in interfaceCompileContext
-
getTransientRelationships
public Collection<Object> getTransientRelationships(org.neo4j.ogm.compiler.SrcTargetKey srcTargetKey) - Specified by:
getTransientRelationships
in interfaceCompileContext
-