Package science.aist.neo4j.reflective
Class ReflectiveNeo4JRelationshipRepositoryImpl<S>
- java.lang.Object
-
- science.aist.neo4j.repository.AbstractNeo4JRepository<S,Long>
-
- science.aist.neo4j.repository.AbstractNeo4JRelationshipRepositoyImpl<S>
-
- science.aist.neo4j.reflective.ReflectiveNeo4JRelationshipRepositoryImpl<S>
-
- Type Parameters:
S
- Type of node
- All Implemented Interfaces:
Neo4jRepository<S,Long>
public class ReflectiveNeo4JRelationshipRepositoryImpl<S> extends AbstractNeo4JRelationshipRepositoyImpl<S>
Implementation ofAbstractNeo4JRelationshipRepositoyImpl
using java reflection- Since:
- 1.0
- Author:
- Oliver Krauss
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<S>
clazz
Class that this repository is managingprotected ClassInformation
info
Metadata for storage purposesprotected AbstractNeo4JRepository
sourceRepository
Repository for the source science.neo4j.nodesprotected AbstractNeo4JRepository
targetRepository
Repository for the taret science.neo4j.nodes
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager)
Empty constructor for child implementations.ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager, Class<S> clazz)
ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager, ParameterizedType type, String name)
Generates the repository by a Generic Type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected S
cast(org.neo4j.driver.Value value, org.neo4j.driver.Value source, org.neo4j.driver.Value target)
Casts the result of the queryTyped into a relationship classprotected Long
getId(S node)
Helper method for finding the id of a nodeprotected Object
getSource(S node)
protected Object
getSourceId(S node)
protected Object
getTarget(S node)
protected Object
getTargetId(S node)
protected <T extends S>
Collection<T>handleSourceAndTarget(Collection<T> nodes)
Helper method that is responsible for storing all source or target science.neo4j.nodes in a multitude of relationshipsprotected <T extends S>
ThandleSourceAndTarget(T node)
Helper method that is responsible for storing source or target science.neo4j.nodes.protected Map<String,Object>
objectify(S node)
Turns all properties of a Relationship into something to be used by the queriesprotected S
setId(S node, Long id)
Helper method for setting the id when a node was stored to the databasevoid
setSourceRepository(AbstractNeo4JRepository sourceRepository)
void
setTargetRepository(AbstractNeo4JRepository targetRepository)
-
Methods inherited from class science.aist.neo4j.repository.AbstractNeo4JRelationshipRepositoyImpl
deleteAll, execute, executeAll, findAll, findAllBy, findBy, findById, findSubtree, findSubtree, findSubtree, init, query, queryAll, save, saveAll
-
Methods inherited from class science.aist.neo4j.repository.AbstractNeo4JRepository
buildParameters, buildWhere, findAllBy, findAllBy, findBy, findBy, getProvidedRepository, getTransactionManager, provideRepository
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface science.aist.neo4j.Neo4jRepository
findAllAsStream
-
-
-
-
Field Detail
-
info
protected ClassInformation info
Metadata for storage purposes
-
sourceRepository
protected AbstractNeo4JRepository sourceRepository
Repository for the source science.neo4j.nodes
-
targetRepository
protected AbstractNeo4JRepository targetRepository
Repository for the taret science.neo4j.nodes
-
-
Constructor Detail
-
ReflectiveNeo4JRelationshipRepositoryImpl
protected ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager)
Empty constructor for child implementations. If you use this one, you must call init() yourself.- Parameters:
manager
- used to handle transactions
-
ReflectiveNeo4JRelationshipRepositoryImpl
public ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager, ParameterizedType type, String name)
Generates the repository by a Generic Type- Parameters:
type
- java generic typename
- of relationship in DB as this is part of the identitymanager
- used to handle transactions
-
ReflectiveNeo4JRelationshipRepositoryImpl
public ReflectiveNeo4JRelationshipRepositoryImpl(TransactionManager manager, Class<S> clazz)
-
-
Method Detail
-
cast
protected S cast(org.neo4j.driver.Value value, org.neo4j.driver.Value source, org.neo4j.driver.Value target)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Casts the result of the queryTyped into a relationship class- Specified by:
cast
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Parameters:
value
- to be castsource
- source node of relationshiptarget
- target node of relationship- Returns:
- relationship object
-
setId
protected S setId(S node, Long id)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Helper method for setting the id when a node was stored to the database- Specified by:
setId
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Parameters:
node
- to be assigned an idid
- of the relationsip- Returns:
- node with id
-
getId
protected Long getId(S node)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Helper method for finding the id of a node- Specified by:
getId
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Parameters:
node
- to return the id from- Returns:
- id of node or null
-
handleSourceAndTarget
protected <T extends S> T handleSourceAndTarget(T node)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Helper method that is responsible for storing source or target science.neo4j.nodes.- Specified by:
handleSourceAndTarget
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Type Parameters:
T
- extension of S- Parameters:
node
- to be saved- Returns:
- node
-
handleSourceAndTarget
protected <T extends S> Collection<T> handleSourceAndTarget(Collection<T> nodes)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Helper method that is responsible for storing all source or target science.neo4j.nodes in a multitude of relationships- Specified by:
handleSourceAndTarget
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Type Parameters:
T
- extension of S- Parameters:
nodes
- to be saved- Returns:
- science.neo4j.nodes
-
objectify
protected Map<String,Object> objectify(S node)
Description copied from class:AbstractNeo4JRelationshipRepositoyImpl
Turns all properties of a Relationship into something to be used by the queries- Specified by:
objectify
in classAbstractNeo4JRelationshipRepositoyImpl<S>
- Parameters:
node
- to be transformed- Returns:
- a map containing the id, and another map that contains all properties
-
setSourceRepository
public void setSourceRepository(AbstractNeo4JRepository sourceRepository)
-
setTargetRepository
public void setTargetRepository(AbstractNeo4JRepository targetRepository)
-
-