fri.util.database.jpa.tree.nestedsets
Interface NestedSetsTreeNode

All Superinterfaces:
java.lang.Cloneable, TreeNode
All Known Subinterfaces:
TemporalNestedSetsTreeNode
All Known Implementing Classes:
NestedSetsTreePojo, NonUniqueNestedSetsTreePojo, PersonNst, PersonTnst, TemporalNestedSetsTreePojo

public interface NestedSetsTreeNode
extends TreeNode

A tree node. It represents a hierarchy of records in a database table without parent references in children or vice versa. The hierarchy is managed via lft and rgt depth-first order numbers directly in the database record. To be able to store more than one tree in a table, every node additionally has a reference to the top-level root node (not to its parent!).

This interface must be implemented by any domain object that represents hierarchical data and should be managed via NestedSetsTreeDao. Do not use these interface methods outside (except clone()), they are for the DAO only.

See http://www.klempert.de/nested_sets/ or Wikipedia "nested sets tree".

Cloneable interface is required only for copy and unique constraint checking. You can return null from clone() if neither is needed.

Author:
Fritz Ritzberger, 08.10.2011
See Also:
NestedSetsTreeDao, test.fri.util.database.jpa.tree.nestedsets.pojos.AbstractNestedSetsTreePojo, test.fri.util.database.jpa.tree.nestedsets.pojos.NestedSetsTreePojo

Method Summary
 NestedSetsTreeNode clone()
          For copy and unique constraint checking this is required.
 int getLeft()
          DO NOT use this, is for the DAO exclusively.
 int getRight()
          DO NOT use this, is for the DAO exclusively.
 NestedSetsTreeNode getTopLevel()
          DO NOT use this, is for the DAO exclusively.
 void setLeft(int left)
          DO NOT use this, is for the DAO exclusively.
 void setRight(int right)
          DO NOT use this, is for the DAO exclusively.
 void setTopLevel(NestedSetsTreeNode topLevel)
          DO NOT use this, is for the DAO exclusively.
 
Methods inherited from interface fri.util.database.jpa.tree.TreeNode
getId
 

Method Detail

getLeft

int getLeft()
DO NOT use this, is for the DAO exclusively. The private Java property name for this MUST BE "lft" in any implementation, as that name is used in DAO queries.

Returns:
the left order number.

setLeft

void setLeft(int left)
DO NOT use this, is for the DAO exclusively. Sets the left order number.


getRight

int getRight()
DO NOT use this, is for the DAO exclusively. The private Java property name for this MUST BE "rgt" in any implementation, as that name is used in DAO queries.

Returns:
the right order number.

setRight

void setRight(int right)
DO NOT use this, is for the DAO exclusively. Sets the right order number.


getTopLevel

NestedSetsTreeNode getTopLevel()
DO NOT use this, is for the DAO exclusively. The private Java property name for this MUST BE "topLevel" in any implementation, as that name is used in DAO queries.

Returns:
the root node of this tree node (root and topLevel are synonyms).

setTopLevel

void setTopLevel(NestedSetsTreeNode topLevel)
DO NOT use this, is for the DAO exclusively. Sets the top-level root of this tree node.


clone

NestedSetsTreeNode clone()
For copy and unique constraint checking this is required.

Specified by:
clone in interface TreeNode
Returns:
a clone of this node, not including the "id" property (which is set by the JPA layer).