|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.entity.AbstractBasicEntity
org.torweg.pulse.util.entity.Node
@Entity @Indexed public class Node
is a base entity to build bi-directional tree entities with positionable children lists.
The EJB 3.0 persistence inheritance type of Node is "JOINED".
Note: The FetchType of the children is
FetchType.LAZY!
if you want to delete a child, you have to update the parent in HibernateTM!
| Constructor Summary | |
|---|---|
Node()
builds a new Node. |
|
| Method Summary | ||
|---|---|---|
void |
addChild(int pos, Node n)
adds a new Node at a given position to the list childrenSet of
this Node. |
|
void |
addChild(Node n)
adds a new Node to the childrenSet of this Node . |
|
Node |
getChild(int pos)
gets the child Node which is at the given position in the child
list. |
|
int |
getChildIndex(Node node)
gets the child Node which is at the given position in the child
list. |
|
java.util.List<Node> |
getChildren()
|
|
Node |
getParent()
|
|
boolean |
hasChildren()
Returns true, if the Node has children. |
|
boolean |
removeChild(Node c)
removes a Node from the list of child Nodes. |
|
|
setChildren(java.util.List<E> c)
sets the childrenSet of the Node. |
|
net.sf.json.JSONObject |
toJSON()
returns a JSONObject representation of the Node . |
|
| Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity |
|---|
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Node()
Node.
| Method Detail |
|---|
public final Node getParent()
Node of the Node or
null, if the Node has no parent.public java.util.List<Node> getChildren()
Node.public Node getChild(int pos)
Node which is at the given position in the child
list.
pos - the position
Node or null, if no such Node exists.public int getChildIndex(Node node)
Node which is at the given position in the child
list.
node - the Node to get the index for
Node's index as int in it's parents list of
children or -1, if no such Node exists.public void addChild(Node n)
Node to the childrenSet of this Node .
n - the Node to become a child of this Node.public void addChild(int pos, Node n)
Node at a given position to the list childrenSet of
this Node.
pos - the position in the list of childrenSetn - the Node to become a child of this Node.public <E extends Node> void setChildren(java.util.List<E> c)
Node.
E - a Node or a subclass of Nodec - the list of child <E extends Node>spublic final boolean removeChild(Node c)
Node from the list of child Nodes.
c - the Node to be removed
true, if the removal was successful. Otherwise
false.public final boolean hasChildren()
true, if the Node has children. Otherwise
false.
Since the children are fetched lazily, this can be used to quickly check,
if the Node contains children without actually loading them.
true, if the Node has children. Otherwise
false.public net.sf.json.JSONObject toJSON()
JSONObject representation of the Node .
JSONObject representation of the Node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||