String firstarea,
String secarea)
throws SiteTreeException {
Publication publication = getPublication();
SiteTree firsttree = publication.getTree(firstarea);
SiteTree sectree = publication.getTree(secarea);
String parentid = "";
StringTokenizer st = new StringTokenizer(secdocumentid, "/");
int length = st.countTokens();
for (int i = 0; i < (length - 1); i++) {
parentid = parentid + "/" + st.nextToken();
}
String newid = st.nextToken();
SiteTreeNode node = firsttree.getNode(firstdocumentid);
if (node != null) {
SiteTreeNode parentNode = sectree.getNode(parentid);
if (parentNode != null) {
sectree.move(node, parentNode, newid, this.getRefdocumentid());
} else {
throw new SiteTreeException(
"The parent node "
+ parentNode
+ " where the removed node shall be inserted not found");
}
} else {
throw new SiteTreeException(
"Node " + node + " couldn't be removed");
}
if (firstarea.equals(secarea)) {
firsttree.save();
} else {
firsttree.save();
sectree.save();
}
}