}
private TreeNode getTreeNode() {
CollectionDao collectionDao = CollectionDao.createInstance();
Collection collection = collectionDao.getRootCollection();
if (collection == null) {
CustomTreeNode treeData = new CustomTreeNode("root", " ", false);
return treeData;
}
String rootName = collection.getName();
CustomTreeNode treeData = new CustomTreeNode("root", rootName, false);
List commnunities = collection.getCollections();
for (Iterator it = commnunities.iterator(); it.hasNext();) {
ViewCollection currentCommunity = new ViewCollection(
(Collection) it.next());
CustomTreeNode tnb = new CustomTreeNode("community",
currentCommunity.getName(), false);
tnb.setContent(currentCommunity);
tnb.setIdentifier(currentCommunity.getId());
tnb.setParent(treeData);
treeData.getChildren().add(tnb);
int foldersCount = this.addCommunity(tnb, currentCommunity);
currentCommunity.setFoldersCount(foldersCount);
}
List folders = collection.getFolders();
for (Iterator it = folders.iterator(); it.hasNext();) {
Folder currentFolder = (Folder) it.next();
addFolder(treeData, new ViewFolder(currentFolder));
}