From 9d5ff6d1e5485f99b4c601c8f44002c509ed7a5a Mon Sep 17 00:00:00 2001 From: Tung Le Date: Wed, 4 Sep 2024 19:30:23 +0700 Subject: [PATCH] IVYPORTAL-17183 Adapt process deprecate on LE Remove GetGroupId process --- .../constant/PortalComponentConstants.java | 1 - .../ivy/add/portalkit/GetGroupIdData.d.json | 10 --- .../Functional Processes/GetGroupId.p.json | 66 ------------------- .../portalkit/bean/ProjectVersionBean.java | 5 +- .../portalkit/constant/PortalConstants.java | 2 +- .../addon/portalkit/enums/PortalLibrary.java | 36 ---------- .../ivydata/service/impl/LibraryService.java | 5 +- .../DeleteFinishedHiddenCasesService.java | 5 +- 8 files changed, 9 insertions(+), 121 deletions(-) delete mode 100644 AxonIvyPortal/portal/dataclasses/ch/ivy/add/portalkit/GetGroupIdData.d.json delete mode 100644 AxonIvyPortal/portal/processes/Functional Processes/GetGroupId.p.json delete mode 100644 AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/enums/PortalLibrary.java diff --git a/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/constant/PortalComponentConstants.java b/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/constant/PortalComponentConstants.java index ae6b6e3728a..4460dadfc9e 100644 --- a/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/constant/PortalComponentConstants.java +++ b/AxonIvyPortal/portal-components/src/com/axonivy/portal/components/constant/PortalComponentConstants.java @@ -4,7 +4,6 @@ public final class PortalComponentConstants { public static final String PORTAL_APPLICATION_NAME = "Portal"; public static final String SECURITY_SERVICE_CALLABLE = "Ivy Data Processes/PortalComponentSecurityService"; - public static final String GET_GROUP_ID_CALLABLE = "Functional Processes/GetGroupId"; private PortalComponentConstants() {} } diff --git a/AxonIvyPortal/portal/dataclasses/ch/ivy/add/portalkit/GetGroupIdData.d.json b/AxonIvyPortal/portal/dataclasses/ch/ivy/add/portalkit/GetGroupIdData.d.json deleted file mode 100644 index d046f6e2077..00000000000 --- a/AxonIvyPortal/portal/dataclasses/ch/ivy/add/portalkit/GetGroupIdData.d.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema" : "https://json-schema.axonivy.com/data-class/11.4.0/data-class.json", - "simpleName" : "GetGroupIdData", - "namespace" : "ch.ivy.add.portalkit", - "isBusinessCaseData" : false, - "fields" : [ { - "name" : "groupId", - "type" : "String" - } ] -} \ No newline at end of file diff --git a/AxonIvyPortal/portal/processes/Functional Processes/GetGroupId.p.json b/AxonIvyPortal/portal/processes/Functional Processes/GetGroupId.p.json deleted file mode 100644 index 9c3d85bdedc..00000000000 --- a/AxonIvyPortal/portal/processes/Functional Processes/GetGroupId.p.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "$schema" : "https://json-schema.axonivy.com/process/11.3.0/process.json", - "id" : "179D696BF6492C34", - "kind" : "CALLABLE_SUB", - "config" : { - "data" : "ch.ivy.add.portalkit.GetGroupIdData" - }, - "elements" : [ { - "id" : "f0", - "type" : "CallSubStart", - "name" : "getGroupId()", - "config" : { - "signature" : "getGroupId", - "result" : { - "params" : [ - { "name" : "groupId", "type" : "String", "desc" : "" } - ], - "map" : { - "result.groupId" : "in.groupId" - } - } - }, - "visual" : { - "at" : { "x" : 96, "y" : 64 }, - "labelOffset" : { "x" : 29, "y" : 37 } - }, - "connect" : [ - { "id" : "f4", "to" : "f3" } - ] - }, { - "id" : "f1", - "type" : "CallSubEnd", - "visual" : { - "at" : { "x" : 416, "y" : 64 } - } - }, { - "id" : "f3", - "type" : "Script", - "name" : [ - "get group id", - "in portal kit" - ], - "config" : { - "output" : { - "code" : [ - "import ch.ivyteam.ivy.project.IvyProjectNavigationUtil;", - "import ch.ivyteam.ivy.project.IIvyProject;", - "import ch.ivyteam.ivy.workflow.IWorkflowProcessModelVersion;", - "", - "IIvyProject ivyProject = IvyProjectNavigationUtil.getIvyProject(ivy.request.getProcessModelVersion());", - "", - "if (ivyProject.getLibrary() != null && ivyProject.getLibrary().getId() != null){", - " in.groupId = ivyProject.getLibrary().getId().groupId();", - "}" - ] - }, - "sudo" : true - }, - "visual" : { - "at" : { "x" : 288, "y" : 64 } - }, - "connect" : [ - { "id" : "f2", "to" : "f1" } - ] - } ] -} \ No newline at end of file diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/bean/ProjectVersionBean.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/bean/ProjectVersionBean.java index 77a11032115..9d1f1a40a9d 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/bean/ProjectVersionBean.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/bean/ProjectVersionBean.java @@ -1,5 +1,7 @@ package ch.ivy.addon.portalkit.bean; +import static ch.ivy.addon.portalkit.constant.PortalConstants.PORTAL_LIBRARY_ID; + import java.io.Serializable; import java.util.List; import java.util.Map; @@ -7,7 +9,6 @@ import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; -import ch.ivy.addon.portalkit.enums.PortalLibrary; import ch.ivy.addon.portalkit.ivydata.service.impl.LibraryService; import ch.ivyteam.ivy.application.IApplication; import ch.ivyteam.ivy.application.ILibrary; @@ -42,7 +43,7 @@ public Map> getProjectLibraries() { public void loadProjectVesion() { engineVersion = ch.ivyteam.ivy.Advisor.getAdvisor().getVersion().toString(); - ILibrary portalLibrary = IApplication.current().findReleasedLibrary(PortalLibrary.PORTAL.getValue()); + ILibrary portalLibrary = IApplication.current().findReleasedLibrary(PORTAL_LIBRARY_ID); portalVersion = portalLibrary.getQualifiedVersion().toString(); projectLibraries = retrieveProjectLibraries(); } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/constant/PortalConstants.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/constant/PortalConstants.java index 4b2450062f5..4af982f2065 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/constant/PortalConstants.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/constant/PortalConstants.java @@ -5,8 +5,8 @@ public final class PortalConstants { public static final String BUILD_CASE_QUERY_CALLABLE = "Functional Processes/BuildCaseQuery"; public static final String BUILD_TASK_QUERY_CALLABLE = "Functional Processes/BuildTaskQuery"; public static final String ANALYZE_STATISTIC_CALLABLE = "Functional Processes/AnalyzeStatistic"; - public static final String GET_GROUP_ID_CALLABLE = "Functional Processes/GetGroupId"; public static final String RESET_TASK_CONFIRMATION_DIALOG = "reset-task-confirmation-dialog"; + public static final String PORTAL_LIBRARY_ID = "com.axonivy.portal:portal"; public static final int CUSTOM_STRING_FIELD_MAX_LENGTH = 2000; public static final Integer[] EXPRESS_INVALID_VERSION = {0}; public static final int EXPRESS_VERSION = 1; diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/enums/PortalLibrary.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/enums/PortalLibrary.java deleted file mode 100644 index f48196f1418..00000000000 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/enums/PortalLibrary.java +++ /dev/null @@ -1,36 +0,0 @@ -package ch.ivy.addon.portalkit.enums; - -import org.apache.commons.lang3.StringUtils; - -import ch.ivy.addon.portalkit.constant.PortalConstants; -import ch.ivyteam.ivy.process.call.SubProcessCall; -import ch.ivyteam.ivy.security.exec.Sudo; - -public enum PortalLibrary { - PORTAL("portal"), - AXON_EXPRESS("axonivy-express"); - private String value; - - private PortalLibrary(String value) { - this.value = value; - } - - public String getValue(){ - return Sudo.get(() -> { - String groupId = SubProcessCall.withPath(PortalConstants.GET_GROUP_ID_CALLABLE) - .withStartName("getGroupId") - .call() - .get("groupId", String.class); - - if (StringUtils.isBlank(groupId)) { - groupId = value.equalsIgnoreCase("portal") ? "com.axonivy.portal" : "ch.ivyteam.ivy.project.portal"; - } - - return String.format("%s:%s", groupId, value); - }); - } - - public String getProjectId() { - return value; - } -} diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LibraryService.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LibraryService.java index 713625a3064..534129012bc 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LibraryService.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LibraryService.java @@ -9,7 +9,7 @@ import org.apache.commons.lang3.StringUtils; -import ch.ivy.addon.portalkit.enums.PortalLibrary; +import ch.ivy.addon.portalkit.constant.PortalConstants; import ch.ivyteam.ivy.application.IApplication; import ch.ivyteam.ivy.application.ILibrary; import ch.ivyteam.ivy.application.ReleaseState; @@ -17,8 +17,7 @@ import ch.ivyteam.ivy.security.ISecurityContext; public class LibraryService{ - final List portalLibraryStrings = Stream.of(PortalLibrary.values()).map(PortalLibrary::getValue) - .collect(Collectors.toList()); + final List portalLibraryStrings = Stream.of(PortalConstants.PORTAL_LIBRARY_ID).collect(Collectors.toList()); public Map> collectLibraries() { Map> libraries = new HashMap<>(); diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DeleteFinishedHiddenCasesService.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DeleteFinishedHiddenCasesService.java index 5918aab3cd5..4600fc34674 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DeleteFinishedHiddenCasesService.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/service/DeleteFinishedHiddenCasesService.java @@ -1,5 +1,7 @@ package ch.ivy.addon.portalkit.service; +import static ch.ivy.addon.portalkit.constant.PortalConstants.PORTAL_LIBRARY_ID; + import java.util.Arrays; import java.util.Date; import java.util.List; @@ -7,7 +9,6 @@ import org.apache.commons.lang3.StringUtils; import ch.ivy.addon.portalkit.enums.AdditionalProperty; -import ch.ivy.addon.portalkit.enums.PortalLibrary; import ch.ivyteam.ivy.application.IApplication; import ch.ivyteam.ivy.application.ILibrary; import ch.ivyteam.ivy.application.IProcessModel; @@ -28,7 +29,7 @@ public void deleteFinishedHiddenCases() { Ivy.log().info("***Job for deleting finished hidden system cases started at: " + currentDate + " by user: " + Ivy.session().getSessionUserName()); boolean shouldDeleteAllCases = Boolean.parseBoolean(Ivy.var().get(DELETE_ALL_FINISHED_HIDDEN_CASES)); - IProcessModelVersion portalPMV = findPortalPMVByLibraryId(IApplication.current(), PortalLibrary.PORTAL.getValue()); + IProcessModelVersion portalPMV = findPortalPMVByLibraryId(IApplication.current(), PORTAL_LIBRARY_ID); if (portalPMV == null) { Ivy.log().warn("Can not retrieve portal PMV"); return ;