String[] childPaths = {""};
String resourceName = "";
boolean hasChildren = false;
ResourceTreeEntryBean resourceEntry;
try {
resourceEntry = client.getResourceTreeEntry(resourcePath);
} catch (Exception e) {
String msg = "Failed to get resource tree entry for resource " +
resourcePath + ". " + e.getMessage();
log.error(msg, e);
throw new RegistryException(msg, e);
}
if (resourceEntry.getCollection()) {
childPaths = resourceEntry.getChildren();
if (childPaths != null && childPaths.length > 0) hasChildren = true;
} else if (hideResources) {
return;
}
if (hasChildren) {
for (int i = 0; childPaths.length > i; i++) {
String[] parts = childPaths[i].split(RegistryConstants.PATH_SEPARATOR);
String fatherId = "father_" + parentId + "_" + i;
String childId = "child_" + parentId + "_" + i;
if (parts != null && parts.length > 1) {
resourceName = parts[parts.length - 1];
}
/* get the child entry for the current entry */
ResourceTreeEntryBean childResouceEntry;
try {
childResouceEntry = client.getResourceTreeEntry(childPaths[i]);
} catch (Exception e) {
String msg = "Failed to get resource tree entry for resource " +
childPaths[i] + ". " + e.getMessage();
log.warn(msg, e);
continue;
}
boolean childHasChildren = false;
if (childResouceEntry.getCollection()) {
String []childChildPaths = childResouceEntry.getChildren();
if (childChildPaths != null && childChildPaths.length > 0) childHasChildren = true;
} else if (hideResources) {
continue;
}
treeData.appendToTree("<div class=\"father-object\" id=\"" + fatherId + "\">");
/* if this has children we let it expandable */
if (childResouceEntry.getCollection()) {
if (childHasChildren) {
treeData.appendToTree("<a onclick=\"loadSubTree('" + childPaths[i] + "', '" + parentId + "_" + i + "', '" + textBoxId + "', '" + (hideResources? "true" : "false") + "')\">");
treeData.appendToTree("<img src=\"../resources/images/icon-tree-plus.jpg\" id=\"plus_" + parentId + "_" + i + "\" style=\"margin-right:5px;\" />" +
"<img src=\"../resources/images/icon-tree-minus.jpg\" id=\"minus_" + parentId + "_" + i + "\" style=\"display:none;margin-right:5px;\"/>");
} else {