[Admin Tools | log4j2]: CommunityController.java: In method "updateCommunity()", update also portalPid in the related menu | MenuService.java: Added method "updatePid()".

This commit is contained in:
Konstantina Galouni 2022-12-16 13:45:03 +02:00
parent 4f62befa74
commit 43a4c1a5a4
2 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -2,6 +2,7 @@ package eu.dnetlib.uoaadmintools.services;
import eu.dnetlib.uoaadmintools.dao.MenuDAO;
import eu.dnetlib.uoaadmintools.dao.MenuItemDAO;
import eu.dnetlib.uoaadmintools.entities.Notifications;
import eu.dnetlib.uoaadmintools.entities.menu.*;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
@ -372,4 +373,14 @@ public class MenuService {
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!");
}
}
}