Package science.aist.neo4j.dynamic
Class DynamicRepository
- java.lang.Object
-
- science.aist.neo4j.dynamic.DynamicRepository
-
public class DynamicRepository extends Object
Repository for saving a dynamic object tree
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Constructor Summary
Constructors Constructor Description DynamicRepository(Map<Class,AbstractNeo4JNodeRepositoyImpl> repositories, TransactionManager transactionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getLabels(long id)
<T> T
load(Long id, Class<T> clazz)
Dynamically loads the object tree with the node of the given id as root<T> T
load(Long id, Class<T> clazz, Class<?>... classes)
Dynamically loads the object tree with the node of the given id as root<T> T
load(Long id, Class<T> clazz, List<Class<?>> classes)
Dynamically loads the object tree with the node of the given id as root<T> T
load(Long id, Class<T> clazz, List<Class<?>> classes, boolean classesForInclude)
Dynamically loads the object tree with the node of the given id as root<T> T
load(Long id, Class<T> clazz, List<Class<?>> classes, boolean classesForInclude, Map<Class<?>,Class<?>> loadMapping)
Dynamically loads the object tree with the node of the given id as root Using the loadMapping parameter this method also allows to load elements with a given dynamic type.<T> T
save(T node)
Saves dynamically typed object tree
-
-
-
Constructor Detail
-
DynamicRepository
public DynamicRepository(@NonNull Map<Class,AbstractNeo4JNodeRepositoyImpl> repositories, @NonNull TransactionManager transactionManager)
-
-
Method Detail
-
save
public <T> T save(T node)
Saves dynamically typed object tree- Type Parameters:
T
- Type of node- Parameters:
node
- root node to be saved- Returns:
- node
-
load
public <T> T load(Long id, Class<T> clazz)
Dynamically loads the object tree with the node of the given id as root- Type Parameters:
T
- type of the root node- Parameters:
id
- id of the root nodeclazz
- type of the root node- Returns:
- The root node with loaded sub nodes
-
load
public <T> T load(Long id, Class<T> clazz, Class<?>... classes)
Dynamically loads the object tree with the node of the given id as root- Type Parameters:
T
- type of the root node- Parameters:
id
- id of the root nodeclazz
- type of the root nodeclasses
- classes of nodes which should not be loaded (if empty or null everything will be loaded)- Returns:
- The root node with loaded sub nodes
-
load
public <T> T load(Long id, Class<T> clazz, List<Class<?>> classes)
Dynamically loads the object tree with the node of the given id as root- Type Parameters:
T
- type of the root node- Parameters:
id
- id of the root nodeclazz
- type of the root nodeclasses
- classes of nodes which should not be loaded (if empty or null everything will be loaded)- Returns:
- The root node with loaded sub nodes
-
load
public <T> T load(Long id, Class<T> clazz, List<Class<?>> classes, boolean classesForInclude)
Dynamically loads the object tree with the node of the given id as root- Type Parameters:
T
- type of the root node- Parameters:
id
- id of the root nodeclazz
- type of the root nodeclasses
- classes of nodes which should (not) be loaded (if empty or null everything will be loaded or nothing will be loaded)classesForInclude
- if true classes parameter will be used as include list; otherwise as an exclude list- Returns:
- The root node with loaded sub nodes
-
load
public <T> T load(Long id, Class<T> clazz, List<Class<?>> classes, boolean classesForInclude, Map<Class<?>,Class<?>> loadMapping)
Dynamically loads the object tree with the node of the given id as root Using the loadMapping parameter this method also allows to load elements with a given dynamic type.- Type Parameters:
T
- type of the root node- Parameters:
id
- id of the root nodeclazz
- type of the root nodeclasses
- classes of nodes which should (not) be loaded (if empty or null everything will be loaded or nothing will be loaded); behaviour depends on classesForInclude parameterclassesForInclude
- if true the classes parameter will be used as include list; otherwise as an exclude listloadMapping
- Map associating a base class which should be interpreted as another class. This means: Load class A with the repository of class B- Returns:
- The root node with loaded sub nodes
-
-