From 23721c14e5d4b86130866365d1d8dd74afcb2c36 Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 10:56:28 +0100 Subject: [PATCH 1/6] Removing home handling controller mappings --- .../dxa/modules/ish/controller/TridionDocsPageController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/TridionDocsPageController.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/TridionDocsPageController.java index d83903222..2d99fba88 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/TridionDocsPageController.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/TridionDocsPageController.java @@ -23,9 +23,11 @@ public class TridionDocsPageController { * @param response Http response * @return Redirects to the home page. */ + /* @RequestMapping(method = RequestMethod.GET, value = "/ish/", produces = {MediaType.TEXT_HTML_VALUE, MediaType.ALL_VALUE}) public String handleGetPage(HttpServletRequest request, HttpServletResponse response) { return "redirect:home"; } + */ } From 02823014c7a1a3703238ef49b14f833c7cf3ee77 Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 10:57:22 +0100 Subject: [PATCH 2/6] Removing home handling controller mappings --- .../sdl/dxa/modules/ish/controller/MainController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/MainController.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/MainController.java index 913433b3e..a3297c032 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/MainController.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/MainController.java @@ -58,10 +58,12 @@ public class MainController { * * @return Home page for Docs (all the publications) */ + /* @RequestMapping(value = {"/home", "/publications/**", "/publications/{value:.+$}"}, method = GET) public String home(){ return getHomeView(); } + */ /** * Home page. @@ -71,12 +73,14 @@ public String home(){ * @return Publication home page content * @throws ContentProviderException in case if data retrieving fails */ + /* @RequestMapping(value = "/{publicationId:[0-9]+}", method = GET) public String home(@PathVariable("publicationId") String publicationId, HttpServletRequest request) throws ContentProviderException { setPageModelOnRequest(publicationId, null, request); return getHomeView(); } + */ /** * Home page. @@ -87,6 +91,7 @@ public String home(@PathVariable("publicationId") String publicationId, * @return content of the page * @throws ContentProviderException in case if data retrieving fails */ + /* @RequestMapping(value = "/{publicationId:[0-9]+}/{pageId}/**", method = GET) public String home(@PathVariable("publicationId") String publicationId, @PathVariable("pageId") String pageId, @@ -94,10 +99,13 @@ public String home(@PathVariable("publicationId") String publicationId, setPageModelOnRequest(publicationId, pageId, request); return getHomeView(); } + */ + /* private String getHomeView() { return "home"; } + */ private void setPageModelOnRequest(String publicationId, String pageId, HttpServletRequest request) throws ContentProviderException { final DocsLocalization localization = (DocsLocalization) webRequestContext.getLocalization(); From 0628fde6e8cdda1bf9de4e898332de672acfd9ba Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 10:57:46 +0100 Subject: [PATCH 3/6] Removing home handling controller mappings --- .../dd/controller/DynamicDocumentationPageController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/controller/DynamicDocumentationPageController.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/controller/DynamicDocumentationPageController.java index 52b183dcd..26aa42f09 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/controller/DynamicDocumentationPageController.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/controller/DynamicDocumentationPageController.java @@ -22,8 +22,10 @@ public class DynamicDocumentationPageController extends BaseController { @Autowired private MainController mainController; + /* @RequestMapping(value = {"/"}, method = GET) public String home() { return mainController.home(); } + */ } From 544b87ca1cfbaf55f5bd1bb638a5da9be7be60cd Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 10:58:11 +0100 Subject: [PATCH 4/6] Removing view resolver --- .../main/java/com/sdl/dxa/modules/dd/DDModuleInitializer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/DDModuleInitializer.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/DDModuleInitializer.java index 7cc9c1627..bc268bdd6 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/DDModuleInitializer.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/dd/DDModuleInitializer.java @@ -42,6 +42,7 @@ protected String getAreaName() { * * @return The view resolver. */ + /* @Bean public ViewResolver viewResolver() { InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); @@ -51,6 +52,7 @@ public ViewResolver viewResolver() { viewResolver.setOrder(Ordered.LOWEST_PRECEDENCE); return viewResolver; } + */ @Bean public ObjectMapper objectMapper() { From 6a7e446107ddf1f6e0fe32115749e1c192e599f3 Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 10:59:02 +0100 Subject: [PATCH 5/6] Adding customMetas to the json output --- .../com/sdl/dxa/modules/ish/model/CustomMeta.java | 14 ++++++++++++++ .../com/sdl/dxa/modules/ish/model/Publication.java | 3 +++ .../ish/services/GraphQLPublicationService.java | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/CustomMeta.java diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/CustomMeta.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/CustomMeta.java new file mode 100644 index 000000000..4b89165a1 --- /dev/null +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/CustomMeta.java @@ -0,0 +1,14 @@ +package com.sdl.dxa.modules.ish.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +@Data +public class CustomMeta { + + @JsonProperty("Key") + private final String key; + + @JsonProperty("Value") + private final String value; +} diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/Publication.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/Publication.java index d4f805573..ff7287ac5 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/Publication.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/model/Publication.java @@ -40,4 +40,7 @@ public class Publication { @JsonProperty("LogicalId") private String logicalId; + + @JsonProperty("CustomMetas") + private List customMetas; } diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/services/GraphQLPublicationService.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/services/GraphQLPublicationService.java index 008ce1117..d5b005f30 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/services/GraphQLPublicationService.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/services/GraphQLPublicationService.java @@ -135,9 +135,13 @@ private com.sdl.dxa.modules.ish.model.Publication buildPublicationFrom(Publicati CustomMetaConnection customMeta = publication.getCustomMetas(); if (customMeta == null) return result; + List customMetas = new ArrayList<>(); + for (CustomMetaEdge customMetaEdge : customMeta.getEdges()) { String value = customMetaEdge.getNode().getValue(); String key = customMetaEdge.getNode().getKey(); + customMetas.add(new com.sdl.dxa.modules.ish.model.CustomMeta(key, value)); + switch (key) { case PublicationTitleMeta: result.setTitle(value); @@ -180,6 +184,8 @@ private com.sdl.dxa.modules.ish.model.Publication buildPublicationFrom(Publicati } } + result.setCustomMetas(customMetas); + return result; } } From a66d5cf50a5fcab5e93ce9a574525ac88f71f648 Mon Sep 17 00:00:00 2001 From: Phil Medcraft Date: Tue, 9 Apr 2024 11:00:33 +0100 Subject: [PATCH 6/6] Fixing issue with PathVariables to comply with Spring Framework 6 --- .../com/sdl/dxa/modules/ish/controller/IshController.java | 8 ++++---- .../mashup/controller/TridionDocsMashupController.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/IshController.java b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/IshController.java index bf6e7a267..456ea2c01 100644 --- a/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/IshController.java +++ b/webapp-java/dxa-module-dynamic-documentation/src/main/java/com/sdl/dxa/modules/ish/controller/IshController.java @@ -118,8 +118,8 @@ public IshController() { */ @RequestMapping(method = {GET, POST}, value = "/api/page/{publicationId}/{pageId}/**", produces = {APPLICATION_JSON_VALUE}) - public ModelAndView getPage(@PathVariable Integer publicationId, - @PathVariable Integer pageId, + public ModelAndView getPage(@PathVariable("publicationId") Integer publicationId, + @PathVariable("pageId") Integer pageId, @RequestParam(value = "conditions", defaultValue = "") String conditions, final HttpServletRequest request, final HttpServletResponse response) throws ContentProviderException, IOException { @@ -148,8 +148,8 @@ public ModelAndView getPage(@PathVariable Integer publicationId, @RequestMapping(method = GET, value = "/binary/{publicationId}/{binaryId}/**", produces = MediaType.ALL_VALUE) @ResponseBody public void getBinaryResource(HttpServletResponse response, - @PathVariable String publicationId, - @PathVariable String binaryId) throws ContentProviderException, BadRequestException, NotFoundException, IOException { + @PathVariable("publicationId") String publicationId, + @PathVariable("binaryId") String binaryId) throws ContentProviderException, BadRequestException, NotFoundException, IOException { int publicationIdInt = -1; try { publicationIdInt = Integer.parseInt(publicationId); diff --git a/webapp-java/dxa-module-tridion-docs-mashup/src/main/java/com/sdl/dxa/modules/docs/mashup/controller/TridionDocsMashupController.java b/webapp-java/dxa-module-tridion-docs-mashup/src/main/java/com/sdl/dxa/modules/docs/mashup/controller/TridionDocsMashupController.java index 95c8dc23f..be5e6783f 100644 --- a/webapp-java/dxa-module-tridion-docs-mashup/src/main/java/com/sdl/dxa/modules/docs/mashup/controller/TridionDocsMashupController.java +++ b/webapp-java/dxa-module-tridion-docs-mashup/src/main/java/com/sdl/dxa/modules/docs/mashup/controller/TridionDocsMashupController.java @@ -143,8 +143,8 @@ private List getTopics(DynamicWidget dynamicWidget, List topics, P */ @RequestMapping(method = GET, value ="/binary/{publicationId}/{binaryId}/**" ,produces = MediaType.ALL_VALUE) @ResponseBody - public ResponseEntity getBinaryResource(@PathVariable Integer publicationId, - @PathVariable Integer binaryId) + public ResponseEntity getBinaryResource(@PathVariable("publicationId") Integer publicationId, + @PathVariable("binaryId") Integer binaryId) throws ContentProviderException, IOException { HttpHeaders responseHeaders = new HttpHeaders();