/** * @param v the vertex to test * @return <code>true</code> if <code>v</code> is neither * a leaf nor the root of this tree */ public boolean isInternal(V v) { if (!delegate.containsVertex(v)) return false; return isLeaf(v) == false && isRoot(v) == false; }
/** * Returns <code>true</code> if <code>v</code> is neither a leaf nor the * root of this tree. * * @return <code>true</code> if <code>v</code> is neither a leaf nor the * root of this tree */ public boolean isInternal(V v) { if (!delegate.containsVertex(v)) { return false; } return isLeaf(v) == false && isRoot(v) == false; }
public void renameCluster(Integer tenantId, String clusterName, String newName) throws ClusterException { ClusterVO cluster = loadCluster(tenantId, idMappingDAO.lookup(clusterName), itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER)); DelegateTree<ClusterVO, ItemAssocVO<Integer,Integer>> tree = clusters.get(tenantId); if (tree.isRoot(cluster)) throw new ClusterException("ROOT cluster cannot be renamed!"); ClusterVO parent = tree.getParent(cluster); ClusterVO newCluster = new ClusterVO(tenantId, idMappingDAO.lookup(newName), itemTypeDAO.getIdOfType(tenantId, ClusterService.ITEMTYPE_CLUSTER), newName, cluster.getDescription()); // add the new cluster addCluster(newCluster, parent); // move all children to the new cluster for (ClusterVO child : tree.getChildren(cluster)) { moveCluster(tenantId, child.getName(), newName); } if (logger.isDebugEnabled()) { logger.debug("removed all children: " + tree.isLeaf(cluster)); } // move all items to the new cluster for (ItemVO<Integer, Integer> item : getItemsOfCluster(cluster)) { addItemToCluster(newCluster, item); } // delete the old cluster removeCluster(tenantId, clusterName); }