WorkspaceImpl currentWorkspace = (WorkspaceImpl) (workspaceId != null && !"".equals(workspaceId) ? UIServices.lookup().getWorkspacesManager().getWorkspace(workspaceId) : NavigationManager.lookup().getCurrentWorkspace());
Section[] rootSections;
if (StringUtils.isEmpty(rootSectionId)) {
rootSections = currentWorkspace.getAllRootSections();
} else {
Section parentSection = currentWorkspace.getSection(Long.decode(rootSectionId));
List children = parentSection.getChildren();
rootSections = (Section[]) children.toArray(new Section[children.size()]);
}
renderFragment("outputStart");
for (int i = 0; i < rootSections.length; i++) {
Section rootSection = rootSections[i];
renderSection(httpServletRequest, httpServletResponse, rootSection, visibleIds, checkedIds, selectableIds, Boolean.TRUE.equals(checkPermissions), showHiddenPages);
}
renderFragment("outputEnd");
} catch (Exception e) {
log.error("Error rendering sections: ", e);