Resource start = fetchResource(baseResourceId);
return getHierarchy(start);
}
private ResourceWithChildren getHierarchy(Resource baseResource) {
ResourceWithChildren rwc = new ResourceWithChildren("" + baseResource.getId(), baseResource.getName());
PageControl pc = new PageControl();
List<Resource> ret = resMgr.findResourceByParentAndInventoryStatus(caller, baseResource,
InventoryStatus.COMMITTED, pc);
if (!ret.isEmpty()) {
List<ResourceWithChildren> resList = new ArrayList<ResourceWithChildren>(ret.size());
for (Resource res : ret) {
ResourceWithChildren child = getHierarchy(res);
resList.add(child);
putToCache(res.getId(), Resource.class, res);
}
if (!resList.isEmpty())
rwc.setChildren(resList);