* @throws IllegalArgumentException if a node with the given dn exists.
*/
public TreePath addSuffix(String suffixDn, String parentSuffixDn)
throws IllegalArgumentException
{
SuffixNode parentNode;
if (parentSuffixDn != null) {
parentNode = findSuffixNode(parentSuffixDn, rootNode);
if (parentNode == null) {
throw new IllegalArgumentException("Invalid suffix dn " +
parentSuffixDn);
}
}
else {
parentNode = rootNode;
}
int index = findChildNode(parentNode, suffixDn);
if (index >= 0) { // A node has alreay this dn -> bug
throw new IllegalArgumentException("Duplicate suffix dn " + suffixDn);
}
else {
index = - (index + 1);
}
SuffixNode newNode = new SuffixNode(suffixDn);
treeModel.insertNodeInto(newNode, parentNode, index);
startRefreshNode(newNode, null, true);
return new TreePath(treeModel.getPathToRoot(newNode));
}