Class AbstractNestedSetService
-
- All Implemented Interfaces:
public abstract class AbstractNestedSetService<T extends INestedSetNode<ID, T>, ID extends Object>
Abstract service class for managing nested set trees.
-
-
Field Summary
Fields Modifier and Type Field Description private final JpaNestedSetRepository<T, ID>
repository
-
Constructor Summary
Constructors Constructor Description AbstractNestedSetService(JpaNestedSetRepository<T, ID> repository)
-
Method Summary
Modifier and Type Method Description JpaNestedSetRepository<T, ID>
getRepository()
final List<T>
getAncestors(T entity)
Get ancestors of a node. final List<T>
getDescendants(T entity)
Get descendants of a node. T
moveUp(T node)
Move a node up in the tree. T
moveDown(T node)
Move a node down in the tree. -
-
Constructor Detail
-
AbstractNestedSetService
AbstractNestedSetService(JpaNestedSetRepository<T, ID> repository)
-
-
Method Detail
-
getRepository
JpaNestedSetRepository<T, ID> getRepository()
-
getAncestors
final List<T> getAncestors(T entity)
Get ancestors of a node.
- Parameters:
entity
- The node whose ancestors are to be found.- Returns:
A list of ancestor nodes.
-
getDescendants
final List<T> getDescendants(T entity)
Get descendants of a node.
- Parameters:
entity
- The node whose descendants are to be found.- Returns:
A list of descendant nodes.
-
moveUp
T moveUp(T node)
Move a node up in the tree.
- Parameters:
node
- The node to be moved up.- Returns:
The updated node.
-
-
-
-