SessionContainer session = requestContainer.getSessionContainer();
SessionContainer permanentSession = session.getPermanentContainer();
profile = (IEngUserProfile) permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
// loads first level functionalities
functionDAO = DAOFactory.getLowFunctionalityDAO();
LowFunctionality root = functionDAO.loadRootLowFunctionality(false);
if (root == null) {
logger.error("Missing root functionality!");
throw new Exception("Missing root functionality!");
}
List firstLevelFunctions = functionDAO.loadChildFunctionalities(root.getId(), false);
// filters the first level functionalities by the profile execution permission
Iterator it = firstLevelFunctions.iterator();
while (it.hasNext()) {
LowFunctionality aFolder = (LowFunctionality) it.next();
if (ObjectsAccessVerifier.canExec(aFolder, profile)) firtsLevelExecutableFolders.add(aFolder);
}
if (firtsLevelExecutableFolders.size() == 0) {
logger.warn("The user has no executable folders");
exit(response);
}
// finds the base folder between the filtered folders specified by request
String folderPath = (String) request.getAttribute(TreeObjectsModule.PATH_SUBTREE);
LowFunctionality baseFolder = null;
if (folderPath != null) {
it = firtsLevelExecutableFolders.iterator();
while (it.hasNext()) {
LowFunctionality aFolder = (LowFunctionality) it.next();
if (aFolder.getPath().equals(folderPath)) {
baseFolder = aFolder;
break;
}
}
}