From a712a503af669d4bc0a3d5e26bf449ae987a5e13 Mon Sep 17 00:00:00 2001 From: Tung Le Date: Thu, 29 Aug 2024 09:10:33 +0700 Subject: [PATCH] IVYPORTAL-17428 Check and remove deprecated features from portal - Code + Docs Removed warning releated to applicationHomeRef(), data class attribute start with Capital, --- .../publicapi/PortalNavigatorInFrameAPI.java | 12 +++++----- .../Start Processes/PortalStart.p.json | 2 +- .../converter/BusinessEntityConverter.java | 3 +-- .../portalkit/service/DashboardService.java | 2 -- .../ch/ivy/addon/portalkit/util/UrlUtils.java | 2 +- .../axonivy/portal/bo/ClientStatistic.java | 1 - .../ui/approveLeave/approveLeave.xhtml | 10 ++++---- .../ui/approveLeave/approveLeaveData.d.json | 10 ++++---- .../approveLeave/approveLeaveProcess.p.json | 24 +++++++++---------- .../CustomLogoutPage.p.json | 2 +- .../developerexamples/util/UrlUtils.java | 2 +- .../ResetTaskIFrameProcess.p.json | 2 +- 12 files changed, 34 insertions(+), 38 deletions(-) diff --git a/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/publicapi/PortalNavigatorInFrameAPI.java b/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/publicapi/PortalNavigatorInFrameAPI.java index 23e0d5442c4..6f91114d289 100644 --- a/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/publicapi/PortalNavigatorInFrameAPI.java +++ b/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/publicapi/PortalNavigatorInFrameAPI.java @@ -28,12 +28,12 @@ public static void navigateToUrl(String url) { PrimeFaces.current().executeScript(statement); } - /** - * Navigate to portal home - */ - public static void navigateToPortalHome() { - navigateToUrl(Ivy.html().applicationHomeRef()); - } + /** + * Navigate to portal home + */ + public static void navigateToPortalHome() { + navigateToUrl(Ivy.html().applicationHomeLink().getAbsoluteEncoded()); + } /** * Navigate to PortalEndPage without finishing a task, e.g. clicking on Cancel diff --git a/AxonIvyPortal/portal/processes/Start Processes/PortalStart.p.json b/AxonIvyPortal/portal/processes/Start Processes/PortalStart.p.json index 8c3a97520d1..cb92d8cb9bf 100644 --- a/AxonIvyPortal/portal/processes/Start Processes/PortalStart.p.json +++ b/AxonIvyPortal/portal/processes/Start Processes/PortalStart.p.json @@ -3029,7 +3029,7 @@ "call" : { "map" : { "param.isTaskFinished" : "in.isTaskFinished", - "param.iCase" : "in.caseSelected" + "param.caze" : "in.caseSelected" } } }, diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java index 17eee3ea058..2c1917cb585 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java @@ -56,8 +56,7 @@ public static T jsonValueToEntity(String jsonValue, Class classType) { } public static T inputStreamToEntity(InputStream inputStream, Class classType) { - try { - new InputStreamReader(inputStream, StandardCharsets.UTF_8); + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { return getObjectMapper().readValue(inputStream, classType); } catch (IOException e) { throw new PortalException(e); diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DashboardService.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DashboardService.java index 5e5f7346f48..90ab5cb9406 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DashboardService.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DashboardService.java @@ -1,6 +1,4 @@ package ch.ivy.addon.portalkit.service; -import java.util.List; - import ch.ivy.addon.portalkit.dto.dashboard.Dashboard; import ch.ivy.addon.portalkit.enums.PortalVariable; diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/UrlUtils.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/UrlUtils.java index 6f29639fbe3..09c1833af22 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/UrlUtils.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/UrlUtils.java @@ -19,7 +19,7 @@ public class UrlUtils { public static String getServerUrl() { URL url; try { - url = new URL(Ivy.html().applicationHomeRef()); + url = Ivy.html().applicationHomeLink().toAbsoluteUri().toURL(); } catch (MalformedURLException e) { throw new PortalException(e); } diff --git a/AxonIvyPortal/portal/src/com/axonivy/portal/bo/ClientStatistic.java b/AxonIvyPortal/portal/src/com/axonivy/portal/bo/ClientStatistic.java index ca660a1c8f9..72fe50d5b50 100644 --- a/AxonIvyPortal/portal/src/com/axonivy/portal/bo/ClientStatistic.java +++ b/AxonIvyPortal/portal/src/com/axonivy/portal/bo/ClientStatistic.java @@ -9,7 +9,6 @@ import ch.ivy.addon.portalkit.configuration.AbstractConfiguration; import ch.ivy.addon.portalkit.dto.DisplayName; -import ch.ivy.addon.portalkit.service.DateTimeGlobalSettingService; import ch.ivyteam.ivy.environment.Ivy; public class ClientStatistic extends AbstractConfiguration { diff --git a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeave.xhtml b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeave.xhtml index a50532538de..622edceab04 100644 --- a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeave.xhtml +++ b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeave.xhtml @@ -23,14 +23,14 @@ - + - - @@ -38,11 +38,11 @@ - + - +
diff --git a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveData.d.json b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveData.d.json index 89b63e5bc7e..7a1e340ab7f 100644 --- a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveData.d.json +++ b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveData.d.json @@ -4,13 +4,13 @@ "namespace" : "internaltest.ui.approveLeave", "isBusinessCaseData" : false, "fields" : [ { - "name" : "Mitarbeiter", + "name" : "mitarbeiter", "type" : "String" }, { - "name" : "Von", + "name" : "von", "type" : "java.util.Date" }, { - "name" : "Bis", + "name" : "bis", "type" : "java.util.Date" }, { "name" : "beantragt", @@ -19,10 +19,10 @@ "name" : "genehmigt", "type" : "Boolean" }, { - "name" : "Ablehnungsgrund", + "name" : "ablehnungsgrund", "type" : "String" }, { - "name" : "Vertretung", + "name" : "vertretung", "type" : "String" }, { "name" : "actualStepIndex", diff --git a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveProcess.p.json b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveProcess.p.json index 6fe374203e8..0a2601d4f49 100644 --- a/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveProcess.p.json +++ b/Showcase/InternalSupport/src_hd/internaltest/ui/approveLeave/approveLeaveProcess.p.json @@ -13,34 +13,34 @@ "signature" : "start", "input" : { "params" : [ - { "name" : "Mitarbeiter", "type" : "String", "desc" : "" }, - { "name" : "Von", "type" : "Date", "desc" : "" }, - { "name" : "Bis", "type" : "Date", "desc" : "" }, + { "name" : "mitarbeiter", "type" : "String", "desc" : "" }, + { "name" : "von", "type" : "Date", "desc" : "" }, + { "name" : "bis", "type" : "Date", "desc" : "" }, { "name" : "beantragt", "type" : "Boolean", "desc" : "" }, - { "name" : "Vertretung", "type" : "String", "desc" : "" }, + { "name" : "vertretung", "type" : "String", "desc" : "" }, { "name" : "processStatus", "type" : "internalPortal.ProcessStatus", "desc" : "" } ], "map" : { "out.actualStepIndex" : "param.processStatus.actualStepIndex", "out.beantragt" : "param.beantragt", - "out.Bis" : "param.Bis", - "out.Mitarbeiter" : "param.Mitarbeiter", + "out.bis" : "param.bis", + "out.mitarbeiter" : "param.mitarbeiter", "out.steps" : "param.processStatus.steps", - "out.Vertretung" : "param.Vertretung", - "out.Von" : "param.Von" + "out.vertretung" : "param.vertretung", + "out.von" : "param.von" } }, "result" : { "params" : [ - { "name" : "Mitarbeiter", "type" : "String", "desc" : "" }, + { "name" : "mitarbeiter", "type" : "String", "desc" : "" }, { "name" : "genehmigt", "type" : "Boolean", "desc" : "" }, - { "name" : "Ablehnungsgrund", "type" : "String", "desc" : "" }, + { "name" : "ablehnungsgrund", "type" : "String", "desc" : "" }, { "name" : "processStatus", "type" : "internalPortal.ProcessStatus", "desc" : "" } ], "map" : { - "result.Mitarbeiter" : "in.Mitarbeiter", + "result.mitarbeiter" : "in.mitarbeiter", "result.genehmigt" : "in.genehmigt", - "result.Ablehnungsgrund" : "in.Ablehnungsgrund", + "result.ablehnungsgrund" : "in.ablehnungsgrund", "result.processStatus.actualStepIndex" : "in.actualStepIndex", "result.processStatus.steps" : "in.steps" } diff --git a/Showcase/portal-developer-examples/processes/Functional Processes/CustomLogoutPage.p.json b/Showcase/portal-developer-examples/processes/Functional Processes/CustomLogoutPage.p.json index 3f210761020..12413ecb5fe 100644 --- a/Showcase/portal-developer-examples/processes/Functional Processes/CustomLogoutPage.p.json +++ b/Showcase/portal-developer-examples/processes/Functional Processes/CustomLogoutPage.p.json @@ -49,7 +49,7 @@ "name" : "Set logout page", "config" : { "output" : { - "code" : "in.logoutPage = ivy.html.applicationHomeRef();" + "code" : "in.logoutPage = ivy.html.applicationHomeLink().getAbsoluteEncoded();" } }, "visual" : { diff --git a/Showcase/portal-developer-examples/src/com/axonivy/portal/developerexamples/util/UrlUtils.java b/Showcase/portal-developer-examples/src/com/axonivy/portal/developerexamples/util/UrlUtils.java index 8b4b1068f72..5e3c74a697e 100644 --- a/Showcase/portal-developer-examples/src/com/axonivy/portal/developerexamples/util/UrlUtils.java +++ b/Showcase/portal-developer-examples/src/com/axonivy/portal/developerexamples/util/UrlUtils.java @@ -12,7 +12,7 @@ public class UrlUtils { public static String getServerUrl() { URL url; try { - url = new URL(Ivy.html().applicationHomeRef()); + url = Ivy.html().applicationHomeLink().toAbsoluteUri().toURL(); } catch (MalformedURLException e) { throw new PortalException(e); } diff --git a/Showcase/portal-developer-examples/src_hd/com/axonivy/portal/developerexamples/ResetTaskIFrame/ResetTaskIFrameProcess.p.json b/Showcase/portal-developer-examples/src_hd/com/axonivy/portal/developerexamples/ResetTaskIFrame/ResetTaskIFrameProcess.p.json index b9c63fa56d9..54205a1d7d8 100644 --- a/Showcase/portal-developer-examples/src_hd/com/axonivy/portal/developerexamples/ResetTaskIFrame/ResetTaskIFrameProcess.p.json +++ b/Showcase/portal-developer-examples/src_hd/com/axonivy/portal/developerexamples/ResetTaskIFrame/ResetTaskIFrameProcess.p.json @@ -71,7 +71,7 @@ "code" : [ "import com.axonivy.portal.components.publicapi.PortalNavigatorInFrameAPI;", "ivy.task.reset();", - "PortalNavigatorInFrameAPI.navigateToUrl(ivy.html.applicationHomeRef());" + "PortalNavigatorInFrameAPI.navigateToUrl(ivy.html.applicationHomeLink().getAbsoluteEncoded());" ] }, "sudo" : true