Merge remote-tracking branch 'origin/log4j2' into beta
This commit is contained in:
commit
8294c4e1e6
|
@ -5,6 +5,7 @@ import com.mongodb.CommandResult;
|
|||
import com.mongodb.DBObject;
|
||||
import eu.dnetlib.uoaadmintools.configuration.GlobalVars;
|
||||
import eu.dnetlib.uoaadmintools.configuration.mongo.MongoConnection;
|
||||
import eu.dnetlib.uoaadmintools.configuration.properties.BrowserCacheConfig;
|
||||
import eu.dnetlib.uoaadmintools.configuration.properties.ManagersApiConfig;
|
||||
import eu.dnetlib.uoaadmintools.configuration.properties.MongoConfig;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
@ -35,6 +36,9 @@ public class AdminToolsCheckDeployController {
|
|||
@Autowired
|
||||
private ManagersApiConfig managersApiConfig;
|
||||
|
||||
@Autowired
|
||||
private BrowserCacheConfig browserCacheConfig;
|
||||
|
||||
@Autowired
|
||||
private GlobalVars globalVars;
|
||||
|
||||
|
@ -68,6 +72,8 @@ public class AdminToolsCheckDeployController {
|
|||
response.put("admintool.managers.api.id", managersApiConfig.getId());
|
||||
response.put("admintool.managers.api.email", managersApiConfig.getEmail());
|
||||
|
||||
response.put("admintool.cache.url", browserCacheConfig.getUrl());
|
||||
|
||||
if(globalVars.date != null) {
|
||||
response.put("Date of deploy", globalVars.date.toString());
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public class CommunityController {
|
|||
subscriberService.updatePid(old_pid, new_pid);
|
||||
layoutService.updatePid(old_pid, new_pid);
|
||||
notificationsService.updatePid(old_pid, new_pid);
|
||||
menuService.updatePid(old_pid, new_pid);
|
||||
}
|
||||
|
||||
return portalResponse;
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package eu.dnetlib.uoaadmintools.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.Menu;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuFull;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuItem;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuItemFull;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.*;
|
||||
import eu.dnetlib.uoaadmintools.services.MenuService;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.dao.PortalDAO;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
|
@ -209,4 +206,13 @@ public class MenuController {
|
|||
public Menu toggleMenu(@PathVariable(value = "pid") String pid, @RequestParam String status, @RequestParam(value="featured", required=false) String isFeatured) throws Exception {
|
||||
return menuService.toggleMenu(pid, status, isFeatured);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAnyAuthority(" +
|
||||
"@AuthorizationService.PORTAL_ADMIN, " +
|
||||
"@AuthorizationService.curator('community')," +
|
||||
"@AuthorizationService.manager('community', #pid))")
|
||||
@RequestMapping(value = {"/community/{pid}/menu/align"}, method = RequestMethod.POST)
|
||||
public Menu alignMenu(@PathVariable(value = "pid") String pid, @RequestParam String alignment) throws Exception {
|
||||
return menuService.alignMenu(pid, alignment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ public class Curator {
|
|||
private List<Affiliation> affiliations;
|
||||
private String photo;
|
||||
private String bio;
|
||||
private boolean visible = true;
|
||||
|
||||
public Curator() {}
|
||||
|
||||
|
@ -66,4 +67,12 @@ public class Curator {
|
|||
public void setBio(String bio) {
|
||||
this.bio = bio;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ public class CuratorResponse {
|
|||
private List<Affiliation> affiliations;
|
||||
private String photo;
|
||||
private String bio;
|
||||
private boolean visible = true;
|
||||
|
||||
public CuratorResponse() {
|
||||
}
|
||||
|
@ -52,4 +53,12 @@ public class CuratorResponse {
|
|||
public void setBio(String bio) {
|
||||
this.bio = bio;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class Menu {
|
|||
public boolean isMenuEnabled;
|
||||
public List<String> featuredMenuItems;
|
||||
public List<String> menuItems;
|
||||
public MenuAlignment featuredAlignment = MenuAlignment.CENTER;
|
||||
|
||||
public Menu(String portalPid) {
|
||||
this.setPortalPid(portalPid);
|
||||
|
@ -21,6 +22,7 @@ public class Menu {
|
|||
this.setFeaturedMenuEnabled(true);
|
||||
this.setMenuItems(new ArrayList<>());
|
||||
this.setFeaturedMenuItems(new ArrayList<>());
|
||||
this.setFeaturedAlignment(MenuAlignment.CENTER.name());
|
||||
}
|
||||
|
||||
public String getPortalPid() {
|
||||
|
@ -62,4 +64,20 @@ public class Menu {
|
|||
public void setMenuItems(List<String> menuItems) {
|
||||
this.menuItems = menuItems;
|
||||
}
|
||||
|
||||
public String getFeaturedAlignment() {
|
||||
if(featuredAlignment == null) {
|
||||
return null;
|
||||
}
|
||||
return featuredAlignment.name();
|
||||
}
|
||||
|
||||
public void setFeaturedAlignment(String featuredAlignment) {
|
||||
if(featuredAlignment == null) {
|
||||
this.featuredAlignment = null;
|
||||
} else {
|
||||
MenuAlignment alignment = MenuAlignment.valueOf(featuredAlignment);
|
||||
this.featuredAlignment = alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package eu.dnetlib.uoaadmintools.entities.menu;
|
||||
|
||||
public enum MenuAlignment {
|
||||
LEFT, CENTER, RIGHT
|
||||
}
|
|
@ -8,6 +8,7 @@ public class MenuFull {
|
|||
public boolean isMenuEnabled;
|
||||
public List<MenuItemFull> featuredMenuItems;
|
||||
public List<MenuItemFull> menuItems;
|
||||
public MenuAlignment featuredAlignment = MenuAlignment.CENTER;
|
||||
|
||||
public String getPortalPid() {
|
||||
return portalPid;
|
||||
|
@ -48,4 +49,20 @@ public class MenuFull {
|
|||
public void setMenuItems(List<MenuItemFull> menuItems) {
|
||||
this.menuItems = menuItems;
|
||||
}
|
||||
|
||||
public String getFeaturedAlignment() {
|
||||
if(featuredAlignment == null) {
|
||||
return null;
|
||||
}
|
||||
return featuredAlignment.name();
|
||||
}
|
||||
|
||||
public void setFeaturedAlignment(String featuredAlignment) {
|
||||
if(featuredAlignment == null) {
|
||||
this.featuredAlignment = null;
|
||||
} else {
|
||||
MenuAlignment alignment = MenuAlignment.valueOf(featuredAlignment);
|
||||
this.featuredAlignment = alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class CuratorService {
|
|||
List<CuratorResponse> curators = new ArrayList<>();
|
||||
for (Manager manager : managerService.getManagers(pid, ManagerService.Type.ID)) {
|
||||
Curator curator = curatorDAO.findById(parseId(manager.getId()));
|
||||
if (curator != null) {
|
||||
if (curator != null && curator.isVisible()) {
|
||||
curators.add(new CuratorResponse(curator));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@ package eu.dnetlib.uoaadmintools.services;
|
|||
|
||||
import eu.dnetlib.uoaadmintools.dao.MenuDAO;
|
||||
import eu.dnetlib.uoaadmintools.dao.MenuItemDAO;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.Menu;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuFull;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuItem;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.MenuItemFull;
|
||||
import eu.dnetlib.uoaadmintools.entities.Notifications;
|
||||
import eu.dnetlib.uoaadmintools.entities.menu.*;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
@ -86,6 +84,7 @@ public class MenuService {
|
|||
if(menu == null) {
|
||||
menuFull.setFeaturedMenuEnabled(true);
|
||||
menuFull.setMenuEnabled(true);
|
||||
menuFull.setFeaturedAlignment(MenuAlignment.CENTER.name());
|
||||
} else {
|
||||
for (String menuItemId : menu.getFeaturedMenuItems()) {
|
||||
featuredMenuItems.add(getFullRootMenuItemById(menuItemId, portalPid, true));
|
||||
|
@ -97,6 +96,7 @@ public class MenuService {
|
|||
|
||||
menuFull.setFeaturedMenuEnabled(menu.getIsFeaturedMenuEnabled());
|
||||
menuFull.setMenuEnabled(menu.getIsMenuEnabled());
|
||||
menuFull.setFeaturedAlignment(menu.getFeaturedAlignment());
|
||||
}
|
||||
|
||||
menuFull.setPortalPid(portalPid);
|
||||
|
@ -366,4 +366,30 @@ public class MenuService {
|
|||
}
|
||||
return menuDAO.save(menu);
|
||||
}
|
||||
|
||||
public Menu alignMenu(String pid, String alignment) {
|
||||
Menu menu = menuDAO.findByPortalPid(pid);
|
||||
menu.setFeaturedAlignment(alignment);
|
||||
|
||||
return menuDAO.save(menu);
|
||||
}
|
||||
|
||||
public void updatePid(String old_pid, String new_pid) {
|
||||
log.debug("menu service: updatePid");
|
||||
Menu menu = menuDAO.findByPortalPid(old_pid);
|
||||
if(menu != null) {
|
||||
menu.setPortalPid(new_pid);
|
||||
menuDAO.save(menu);
|
||||
log.debug("menu saved!");
|
||||
}
|
||||
|
||||
List<MenuItem> menuItems = menuItemDAO.findByPortalPid(old_pid);
|
||||
if(menuItems != null) {
|
||||
menuItems.forEach(menuItem -> {
|
||||
menuItem.setPortalPid(new_pid);
|
||||
menuItemDAO.save(menuItem);
|
||||
log.debug("menuItem saved!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue