diff --git a/pom.xml b/pom.xml
index 141da51..c1030a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
eu.dnetlib
uoa-admin-tools-library
- 1.0.6
+ 1.0.7
diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java
index 84e9f13..115d580 100644
--- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java
+++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java
@@ -7,6 +7,7 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalResponse;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.utils.RolesUtils;
+import eu.dnetlib.uoaadmintoolslibrary.services.PageService;
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -43,6 +44,9 @@ public class CommunityController {
@Autowired
private PortalService portalService;
+ @Autowired
+ private PageService pageService;
+
@RequestMapping(value = {""}, method = RequestMethod.GET)
public List getAllCommunities() {
return portalService.getAllPortalsByType("community");
@@ -73,6 +77,7 @@ public class CommunityController {
layoutService.updatePid(old_pid, new_pid);
notificationsService.updatePid(old_pid, new_pid);
menuService.updatePid(old_pid, new_pid);
+ pageService.updatePid(old_pid, new_pid, portal.getType());
}
return portalResponse;
diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/ConnectController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/ConnectController.java
index 3da4d68..0edb39a 100644
--- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/ConnectController.java
+++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/ConnectController.java
@@ -6,6 +6,7 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalResponse;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
+import eu.dnetlib.uoaadmintoolslibrary.services.PageService;
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -27,6 +28,9 @@ public class ConnectController {
@Autowired
private PortalService portalService;
+ @Autowired
+ private PageService pageService;
+
@PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
@RequestMapping(value = "/update", method = RequestMethod.POST)
public PortalResponse updateConnect(@RequestBody Portal portal) {
@@ -35,12 +39,14 @@ public class ConnectController {
throw new MismatchingContentException("Update Connect: Portal with id: " + portal.getId() + " has type: " + portal.getType() + " instead of connect");
}
+ String old_pid = portalService.getPortalById(portal.getId()).getPid();
+ String new_pid = portal.getPid();
+
PortalResponse portalResponse = portalService.updatePortal(portal);
- String old_pid = portalResponse.getPid();
- String new_pid = portal.getPid();
if (!old_pid.equals(new_pid)) {
layoutService.updatePid(old_pid, new_pid);
+ pageService.updatePid(old_pid, new_pid, portal.getType());
}
return portalResponse;
diff --git a/src/main/java/eu/dnetlib/uoaadmintools/controllers/ExploreController.java b/src/main/java/eu/dnetlib/uoaadmintools/controllers/ExploreController.java
index a9b06c0..87edf69 100644
--- a/src/main/java/eu/dnetlib/uoaadmintools/controllers/ExploreController.java
+++ b/src/main/java/eu/dnetlib/uoaadmintools/controllers/ExploreController.java
@@ -4,6 +4,7 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalResponse;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
+import eu.dnetlib.uoaadmintoolslibrary.services.PageService;
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -23,13 +24,23 @@ public class ExploreController {
@Autowired
private PortalService portalService;
+ @Autowired
+ private PageService pageService;
+
@RequestMapping(value = "/update", method = RequestMethod.POST)
public PortalResponse updateExplore(@RequestBody Portal portal) {
if(!portal.getType().equals("explore")) {
// EXCEPTION - MismatchingContent
throw new MismatchingContentException("Update Explore: Portal with id: "+portal.getId()+" has type: "+portal.getType()+" instead of explore");
}
+ String old_pid = portalService.getPortalById(portal.getId()).getPid();
+ String new_pid = portal.getPid();
+
PortalResponse portalResponse = portalService.updatePortal(portal);
+
+ if (!old_pid.equals(new_pid)) {
+ pageService.updatePid(old_pid, new_pid, portal.getType());
+ }
return portalResponse;
}