//build structure
for(String module : menuSorted) {
String path = configurationService.getPath() + moduleService.getModuleWeb(module);
if(moduleHasAdminPages(module)) {
MenuItem menu_item = new MenuItem();
menu_item.getProperties().put("title",module);
menu_item.getProperties().put("baseurl",moduleService.getModuleConfiguration(module).getConfiguration().getString("baseurl","/"+module));
for(String page : moduleService.getAdminPages(module)) {
if(page.equals("")) {
continue;
}
MenuItem submenu = new MenuItem();
submenu.getProperties().put("title",getNameFromPath(page));
submenu.getProperties().put("path",path+page);
//test if it is active
menu_item.getSubmenu().add(submenu);
path_titles.put(path+page,page);
}
if(moduleService.getWebservices(module)!=null &&
!moduleService.getWebservices(module).isEmpty() &&
!moduleService.getWebservices(module).iterator().next().equals("")) {
MenuItem submenu = new MenuItem();
submenu.getProperties().put("title",DEFAULT_TITLE_FOR_WEBSERVICES);
submenu.getProperties().put("path",path+DEFAULT_REST_PATH+DEFAULT_REST_FILE);
//test if it is active
menu_item.getSubmenu().add(submenu);
path_titles.put(path+DEFAULT_REST_PATH+DEFAULT_REST_FILE,DEFAULT_TITLE_FOR_WEBSERVICES);
}
menuItems.add(menu_item);