N - The type of node we storepublic class DnNode<N> extends Object
| Modifier and Type | Field and Description |
|---|---|
private Map<org.apache.directory.api.ldap.model.name.Rdn,DnNode<N>> |
children
Stores the list of all the descendant
|
private int |
depth
The node's depth in the tree
|
private static org.slf4j.Logger |
LOG
The logger for this class
|
private org.apache.directory.api.ldap.model.name.Dn |
nodeDn
The node's Dn
|
private N |
nodeElement
The stored element
|
private org.apache.directory.api.ldap.model.name.Rdn |
nodeRdn
The node's key
|
private DnNode<N> |
parent
The parent, if any
|
| Constructor and Description |
|---|
DnNode()
Creates a new instance of DnNode.
|
DnNode(org.apache.directory.api.ldap.model.name.Dn dn,
N element)
Creates a new instance of DnNode.
|
DnNode(N element)
Creates a new instance of DnNode.
|
| Modifier and Type | Method and Description |
|---|---|
DnNode<N> |
add(org.apache.directory.api.ldap.model.name.Dn dn)
Add a new node in the tree.
|
DnNode<N> |
add(org.apache.directory.api.ldap.model.name.Dn dn,
N element)
Add a new node in the tree.
|
private void |
checkDn(org.apache.directory.api.ldap.model.name.Dn dn)
Check that the Dn is not null
|
boolean |
contains(org.apache.directory.api.ldap.model.name.Rdn rdn)
Tells if the current DnBranchNode contains another node associated
with an rdn.
|
private DnNode<N> |
createNode(org.apache.directory.api.ldap.model.name.Dn dn,
N element,
int nbRdns)
Create a new DnNode, recursively creating all the intermediate nodes.
|
DnNode<N> |
getChild(org.apache.directory.api.ldap.model.name.Rdn rdn)
Get's a child using an rdn string.
|
Map<org.apache.directory.api.ldap.model.name.Rdn,DnNode<N>> |
getChildren() |
List<N> |
getDescendantElements(org.apache.directory.api.ldap.model.name.Dn dn) |
private void |
getDescendantElements(DnNode<N> node,
List<N> descendants)
recursively get all the elements from nodes having an element
|
org.apache.directory.api.ldap.model.name.Dn |
getDn() |
N |
getElement() |
N |
getElement(org.apache.directory.api.ldap.model.name.Dn dn) |
DnNode<N> |
getNode(org.apache.directory.api.ldap.model.name.Dn dn)
Get the Node for a given Dn, if present in the tree.
For instance, if we have stored dc=acme, dc=org into the tree, the Dn: ou=example, dc=acme, dc=org will have a parent, and dc=acme, dc=org will be returned. |
DnNode<N> |
getParent() |
DnNode<N> |
getParentWithElement()
Get the closest Node for a given Dn which has an element, if present in the tree.
For instance, if we have stored dc=acme, dc=org into the tree, the Dn: ou=example, dc=acme, dc=org will have a parent, and dc=acme, dc=org will be returned if it has an associated element. |
DnNode<N> |
getParentWithElement(org.apache.directory.api.ldap.model.name.Dn dn)
Get the closest Node for a given Dn which has an element, if present in the tree.
For instance, if we have stored dc=acme, dc=org into the tree, the Dn: ou=example, dc=acme, dc=org will have a parent, and dc=acme, dc=org will be returned if it has an associated element. |
org.apache.directory.api.ldap.model.name.Rdn |
getRdn() |
boolean |
hasChildren()
Tells if the current DnNode has some children or not
|
boolean |
hasChildren(org.apache.directory.api.ldap.model.name.Dn dn)
Tells if a node has some children or not.
|
boolean |
hasDescendantElement(org.apache.directory.api.ldap.model.name.Dn dn) |
private boolean |
hasDescendantElement(DnNode<N> node)
recursively check if the node has a descendant having an element
|
boolean |
hasElement() |
boolean |
hasElement(org.apache.directory.api.ldap.model.name.Dn dn) |
boolean |
hasParent() |
boolean |
hasParent(org.apache.directory.api.ldap.model.name.Dn dn)
Tells if there is a parent for a given Dn,.
|
boolean |
hasParentElement(org.apache.directory.api.ldap.model.name.Dn dn)
Get the closest Node for a given Dn which has an element, if present in the tree.
For instance, if we have stored dc=acme, dc=org into the tree, the Dn: ou=example, dc=acme, dc=org will have a parent, and dc=acme, dc=org will be returned if it has an associated element. |
boolean |
isLeaf()
Tells if the implementation is a leaf node.
|
boolean |
isLeaf(org.apache.directory.api.ldap.model.name.Dn dn)
Tells if the implementation is a leaf node.
|
void |
move(org.apache.directory.api.ldap.model.name.Dn newParent)
move the DnNode's Dn
|
void |
remove(org.apache.directory.api.ldap.model.name.Dn dn)
Removes a node from the tree.
|
void |
rename(org.apache.directory.api.ldap.model.name.Rdn newRdn)
rename the DnNode's Dn
|
private void |
setElement(N element)
Store the given element into the node
|
int |
size()
Returns the number of entries under this node.
|
String |
toString() |
private String |
toString(String tabs) |
private void |
updateAfterModDn(org.apache.directory.api.ldap.model.name.Dn newParentDn)
update the children's Dn based on the new parent Dn created
after a rename or move operation
|
private static final org.slf4j.Logger LOG
private N nodeElement
private org.apache.directory.api.ldap.model.name.Rdn nodeRdn
private org.apache.directory.api.ldap.model.name.Dn nodeDn
private int depth
public DnNode()
public DnNode(N element)
element - the element to storepublic DnNode(org.apache.directory.api.ldap.model.name.Dn dn,
N element)
dn - the node's Dnelement - the element to storeprivate void checkDn(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate DnNode<N> createNode(org.apache.directory.api.ldap.model.name.Dn dn, N element, int nbRdns) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void setElement(N element)
public boolean isLeaf()
true if the class is a leaf node, false otherwise.public boolean isLeaf(org.apache.directory.api.ldap.model.name.Dn dn)
dn - The Dn we want to checktrue if this is a leaf node, false otherwise.public int size()
public N getElement()
public N getElement(org.apache.directory.api.ldap.model.name.Dn dn)
dn - The Dn we want to get the element forpublic boolean hasElement()
public boolean hasElement(org.apache.directory.api.ldap.model.name.Dn dn)
dn - The Dn we want to get the element forprivate boolean hasDescendantElement(DnNode<N> node)
public boolean hasDescendantElement(org.apache.directory.api.ldap.model.name.Dn dn)
dn - The Dn we want to get the element forprivate void getDescendantElements(DnNode<N> node, List<N> descendants)
public List<N> getDescendantElements(org.apache.directory.api.ldap.model.name.Dn dn)
dn - The Dn we want to get the element forpublic boolean hasChildren()
true if the node has some childrenpublic boolean hasChildren(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
dn - the node's Dntrue if the node has some childrenorg.apache.directory.api.ldap.model.exception.LdapException - if the Dn is null or emptypublic Map<org.apache.directory.api.ldap.model.name.Rdn,DnNode<N>> getChildren()
public boolean hasParent()
public boolean hasParent(org.apache.directory.api.ldap.model.name.Dn dn)
dn - the normalized distinguished name to resolve to a parentpublic DnNode<N> add(org.apache.directory.api.ldap.model.name.Dn dn) throws org.apache.directory.api.ldap.model.exception.LdapException
dn - The node's Dnorg.apache.directory.api.ldap.model.exception.LdapException - if the Dn is null or emptypublic DnNode<N> add(org.apache.directory.api.ldap.model.name.Dn dn, N element) throws org.apache.directory.api.ldap.model.exception.LdapException
dn - The node's Dnelement - The element to associate with this Node. Can be null.org.apache.directory.api.ldap.model.exception.LdapException - if the Dn is null or emptypublic void remove(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
dn - the node's Dnorg.apache.directory.api.ldap.model.exception.LdapException - if the Dn is null or emptypublic boolean contains(org.apache.directory.api.ldap.model.name.Rdn rdn)
rdn - The name we are looking fortrue if the tree instance contains this namepublic DnNode<N> getChild(org.apache.directory.api.ldap.model.name.Rdn rdn)
rdn - the rdn to use as the node keypublic org.apache.directory.api.ldap.model.name.Rdn getRdn()
public DnNode<N> getNode(org.apache.directory.api.ldap.model.name.Dn dn)
dn - the normalized distinguished name to resolve to a parentpublic boolean hasParentElement(org.apache.directory.api.ldap.model.name.Dn dn)
dn - the normalized distinguished name to resolve to a parentpublic DnNode<N> getParentWithElement(org.apache.directory.api.ldap.model.name.Dn dn)
dn - the normalized distinguished name to resolve to a parentpublic DnNode<N> getParentWithElement()
public void rename(org.apache.directory.api.ldap.model.name.Rdn newRdn)
throws org.apache.directory.api.ldap.model.exception.LdapException
newRdn - the new Rdn of this nodeorg.apache.directory.api.ldap.model.exception.LdapException - If the rename failedpublic void move(org.apache.directory.api.ldap.model.name.Dn newParent)
throws org.apache.directory.api.ldap.model.exception.LdapException
newParent - the new parent Dnorg.apache.directory.api.ldap.model.exception.LdapException - If the move failedprivate void updateAfterModDn(org.apache.directory.api.ldap.model.name.Dn newParentDn)
throws org.apache.directory.api.ldap.model.exception.LdapInvalidDnException
newParentDn - org.apache.directory.api.ldap.model.exception.LdapInvalidDnExceptionpublic org.apache.directory.api.ldap.model.name.Dn getDn()
Copyright © 2003–2017 The Apache Software Foundation. All rights reserved.