//update parents to new version delete old versions parents if not
// live.
while (parentsIterator.hasNext()) {
Object obj = parentsIterator.next();
if(obj instanceof Inode){
Inode parentInode = (Inode) obj;
if(!InodeUtils.isSet(parentInode.getInode())){
continue;
}
parentInode.addChild(workingLink);
//to keep relation types from parent only if it exists
Tree tree = com.dotmarketing.factories.TreeFactory.getTree(
parentInode, linkVersion);
if ((tree.getRelationType() != null)
&& (tree.getRelationType().length() != 0)) {
Tree newTree = com.dotmarketing.factories.TreeFactory.getTree(
parentInode, workingLink);
newTree.setRelationType(tree.getRelationType());
newTree.setTreeOrder(0);
TreeFactory.saveTree(newTree);
}
// checks type of parent and deletes child if not live version.
if (!linkVersion.isLive()) {
if (parentInode instanceof Inode) {
parentInode.deleteChild(linkVersion);
}
}
}
}