|
Spring Data Graph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.data.graph.neo4j.support.typerepresentation.SubReferenceNodeTypeRepresentationStrategy
public class SubReferenceNodeTypeRepresentationStrategy
A TypeRepresentationStrategy
that uses a hierarchy of reference nodes to represent the java type of the entity in the
graph database. Entity nodes are related to their concrete type via an INSTANCE_OF relationship, the type hierarchy is
related to supertypes via SUBCLASS_OF relationships. Each concrete subreference node keeps a count property with the number of
instances of this class in the graph.
Field Summary | |
---|---|
static org.neo4j.graphdb.RelationshipType |
INSTANCE_OF_RELATIONSHIP_TYPE
|
static org.neo4j.graphdb.RelationshipType |
SUBCLASS_OF_RELATIONSHIP_TYPE
|
static String |
SUBREF_CLASS_KEY
|
static String |
SUBREF_PREFIX
|
static String |
SUBREFERENCE_NODE_COUNTER_KEY
|
Constructor Summary | |
---|---|
SubReferenceNodeTypeRepresentationStrategy(org.neo4j.graphdb.GraphDatabaseService graphDatabaseService,
org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node> entityInstantiator)
|
Method Summary | ||
---|---|---|
static void |
acquireWriteLock(org.neo4j.graphdb.PropertyContainer entity)
|
|
long |
count(Class<? extends NodeBacked> entityClass)
|
|
|
createEntity(org.neo4j.graphdb.Node state)
Instantiate the entity given its state. |
|
|
createEntity(org.neo4j.graphdb.Node state,
Class<U> type)
Instantiate the entity given its state. |
|
static Integer |
decrementAndGetCounter(org.neo4j.graphdb.Node node,
String propertyKey,
int notLowerThan)
|
|
|
findAll(Class<T> clazz)
|
|
org.neo4j.graphdb.Node |
findSubreferenceNode(Class<? extends NodeBacked> entityClass)
|
|
|
getJavaType(org.neo4j.graphdb.Node node)
|
|
org.neo4j.graphdb.Node |
getOrCreateSubReferenceNode(org.neo4j.graphdb.RelationshipType relType)
|
|
static org.neo4j.graphdb.Node |
getSingleOtherNode(org.neo4j.graphdb.Node node,
org.neo4j.graphdb.RelationshipType type,
org.neo4j.graphdb.Direction direction)
|
|
static Integer |
incrementAndGetCounter(org.neo4j.graphdb.Node node,
String propertyKey)
|
|
org.neo4j.graphdb.Node |
obtainSubreferenceNode(Class<?> entityClass)
|
|
void |
postEntityCreation(org.neo4j.graphdb.Node state,
Class<? extends NodeBacked> type)
Callback for setting up and/or storing type information after creation. |
|
void |
preEntityRemoval(org.neo4j.graphdb.Node state)
Callback for cleaning up type information before removal. |
|
|
projectEntity(org.neo4j.graphdb.Node state,
Class<U> type)
Instantiate the entity of the given type, with the given state as backing state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.neo4j.graphdb.RelationshipType INSTANCE_OF_RELATIONSHIP_TYPE
public static final org.neo4j.graphdb.RelationshipType SUBCLASS_OF_RELATIONSHIP_TYPE
public static final String SUBREFERENCE_NODE_COUNTER_KEY
public static final String SUBREF_PREFIX
public static final String SUBREF_CLASS_KEY
Constructor Detail |
---|
public SubReferenceNodeTypeRepresentationStrategy(org.neo4j.graphdb.GraphDatabaseService graphDatabaseService, org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node> entityInstantiator)
Method Detail |
---|
public static org.neo4j.graphdb.Node getSingleOtherNode(org.neo4j.graphdb.Node node, org.neo4j.graphdb.RelationshipType type, org.neo4j.graphdb.Direction direction)
public static Integer incrementAndGetCounter(org.neo4j.graphdb.Node node, String propertyKey)
public static Integer decrementAndGetCounter(org.neo4j.graphdb.Node node, String propertyKey, int notLowerThan)
public static void acquireWriteLock(org.neo4j.graphdb.PropertyContainer entity)
public void postEntityCreation(org.neo4j.graphdb.Node state, Class<? extends NodeBacked> type)
TypeRepresentationStrategy
postEntityCreation
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
state
- Backing state of entity being createdtype
- Type of entity being createdpublic long count(Class<? extends NodeBacked> entityClass)
count
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
public <T extends NodeBacked> Class<T> getJavaType(org.neo4j.graphdb.Node node)
getJavaType
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
public void preEntityRemoval(org.neo4j.graphdb.Node state)
TypeRepresentationStrategy
preEntityRemoval
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
state
- Backing state of entity being removedpublic <T extends NodeBacked> org.neo4j.helpers.collection.ClosableIterable<T> findAll(Class<T> clazz)
findAll
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
clazz
- Type whose instances should be iterated over
public org.neo4j.graphdb.Node obtainSubreferenceNode(Class<?> entityClass)
public org.neo4j.graphdb.Node findSubreferenceNode(Class<? extends NodeBacked> entityClass)
public org.neo4j.graphdb.Node getOrCreateSubReferenceNode(org.neo4j.graphdb.RelationshipType relType)
public <U extends NodeBacked> U createEntity(org.neo4j.graphdb.Node state)
TypeRepresentationStrategy
createEntity
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
U
- Helper parameter for castless usestate
- Backing state of entity to be instantiated
public <U extends NodeBacked> U createEntity(org.neo4j.graphdb.Node state, Class<U> type)
TypeRepresentationStrategy
IllegalArgumentException
is thrown.
createEntity
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
state
- Backing state of entity to be instantiatedtype
- Type of entity to be instantiated
public <U extends NodeBacked> U projectEntity(org.neo4j.graphdb.Node state, Class<U> type)
TypeRepresentationStrategy
projectEntity
in interface TypeRepresentationStrategy<org.neo4j.graphdb.Node,NodeBacked>
state
- Backing state of entity to be instantiatedtype
- Type of entity to be instantiated
|
Spring Data Graph | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |