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 ofAbstractNeo4JRelationshipRepositoyImplusing java reflection- Since:
- 1.0
- Author:
- Oliver Krauss
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<S>clazzClass that this repository is managingprotected ClassInformationinfoMetadata for storage purposesprotected AbstractNeo4JRepositorysourceRepositoryRepository for the source science.neo4j.nodesprotected AbstractNeo4JRepositorytargetRepositoryRepository for the taret science.neo4j.nodes
-
Constructor Summary
Constructors Modifier Constructor Description protectedReflectiveNeo4JRelationshipRepositoryImpl(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 Scast(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 LonggetId(S node)Helper method for finding the id of a nodeprotected ObjectgetSource(S node)protected ObjectgetSourceId(S node)protected ObjectgetTarget(S node)protected ObjectgetTargetId(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 SsetId(S node, Long id)Helper method for setting the id when a node was stored to the databasevoidsetSourceRepository(AbstractNeo4JRepository sourceRepository)voidsetTargetRepository(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:AbstractNeo4JRelationshipRepositoyImplCasts the result of the queryTyped into a relationship class- Specified by:
castin 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:AbstractNeo4JRelationshipRepositoyImplHelper method for setting the id when a node was stored to the database- Specified by:
setIdin 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:AbstractNeo4JRelationshipRepositoyImplHelper method for finding the id of a node- Specified by:
getIdin 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:AbstractNeo4JRelationshipRepositoyImplHelper method that is responsible for storing source or target science.neo4j.nodes.- Specified by:
handleSourceAndTargetin 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:AbstractNeo4JRelationshipRepositoyImplHelper method that is responsible for storing all source or target science.neo4j.nodes in a multitude of relationships- Specified by:
handleSourceAndTargetin 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:AbstractNeo4JRelationshipRepositoyImplTurns all properties of a Relationship into something to be used by the queries- Specified by:
objectifyin 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)
-
-