From c66e08ffc99b90b0260bdc607d756a4335329c6d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 26 Mar 2024 16:58:47 +0100 Subject: [PATCH 1/8] updated SearchingFilter --- CHANGELOG.md | 4 ++++ pom.xml | 2 +- .../shared/SearchingFilter.java | 22 ++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7223704..1e2aa9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.4.0-SNAPSHOT] + +- Search Filter for profileId and projectID [#27120] + ## [v2.3.0] - Read countByPhase from configuration [#25598] diff --git a/pom.xml b/pom.xml index 0807671..2e115d3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.application geoportal-data-common - 2.3.0 + 2.4.0-SNAPSHOT GeoPortal Data Common is common library used by GUI components developed for GeoNA diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/SearchingFilter.java b/src/main/java/org/gcube/application/geoportalcommon/shared/SearchingFilter.java index c01df09..a3deb3f 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/SearchingFilter.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/SearchingFilter.java @@ -90,6 +90,10 @@ public class SearchingFilter implements Serializable { private LinkedHashMap projection; + private String profileID; + + private String projectID; + /** * Instantiates a new sort filter. */ @@ -180,6 +184,19 @@ public class SearchingFilter implements Serializable { this.orderByFields = orderByFields; } + public void setGetForIDs(String profileID, String projectID) { + this.profileID = profileID; + this.projectID = projectID; + } + + public String getProfileID() { + return profileID; + } + + public String getProjectID() { + return projectID; + } + /** * Sets the order. * @@ -200,8 +217,11 @@ public class SearchingFilter implements Serializable { builder.append(conditions); builder.append(", projection="); builder.append(projection); + builder.append(", profileID="); + builder.append(profileID); + builder.append(", projectID="); + builder.append(projectID); builder.append("]"); return builder.toString(); } - } -- 2.17.1 From 235c12f294c456944d6025292b2c44f19c7d8f33 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 5 Apr 2024 10:50:21 +0200 Subject: [PATCH 2/8] - Integrated new Uri-Resolver-Manager [#27160] - Added new operation "Share project" --- CHANGELOG.md | 2 + .../geoportalcommon/GeoportalCommon.java | 20 +++++++++ .../shared/GeoportalItemReferences.java | 45 +++++++++++++++++-- .../shared/config/OPERATION_ON_ITEM.java | 27 +++++------ 4 files changed, 78 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e2aa9f..60628c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v2.4.0-SNAPSHOT] - Search Filter for profileId and projectID [#27120] +- Integrated new Uri-Resolver-Manager [#27160] +- Added new operation "Share project" ## [v2.3.0] diff --git a/src/main/java/org/gcube/application/geoportalcommon/GeoportalCommon.java b/src/main/java/org/gcube/application/geoportalcommon/GeoportalCommon.java index f3888d5..600169b 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/GeoportalCommon.java +++ b/src/main/java/org/gcube/application/geoportalcommon/GeoportalCommon.java @@ -8,10 +8,12 @@ import java.util.Map; import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; +import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO; import org.gcube.application.geoportalcommon.shared.PublicLink; import org.gcube.portlets.user.uriresolvermanager.UriResolverManager; import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder; import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS; +import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.TARGET_GEOPORTAL_APP; import org.gcube.portlets.user.urlshortener.UrlShortener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,6 +67,24 @@ public class GeoportalCommon { item.getProjectID()); builder.scope(gcubeScope); builder.resolverAs(RESOLVE_AS.PRIVATE); + + SHARE_LINK_TO shareLinkTo = item.getShareLinkTo(); + TARGET_GEOPORTAL_APP targetApp = null; + if (shareLinkTo != null) { + + switch (shareLinkTo) { + case DATA_ENTRY: + targetApp = TARGET_GEOPORTAL_APP.GEO_DE; + break; + case DATA_VIEWER: + default: + targetApp = TARGET_GEOPORTAL_APP.GEO_DV; + break; + } + + builder.targetApp(targetApp); + } + // builder.resolverAs(RESOLVE_AS.PRIVATE); Map params = builder.buildQueryParameters(); String link = resolver.getLink(params, false); diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/GeoportalItemReferences.java b/src/main/java/org/gcube/application/geoportalcommon/shared/GeoportalItemReferences.java index 7f13280..e10d0e4 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/GeoportalItemReferences.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/GeoportalItemReferences.java @@ -16,6 +16,17 @@ public class GeoportalItemReferences implements Serializable { */ private static final long serialVersionUID = -7021431511279022193L; + /** + * The Enum SHARE_LINK_TO. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Apr 5, 2024 + */ + public static enum SHARE_LINK_TO { + DATA_VIEWER, DATA_ENTRY + } + // this is the mongoID private String projectID; private String profileID; // this is the profileID - UCD @@ -26,25 +37,43 @@ public class GeoportalItemReferences implements Serializable { private String layerObjectType; + private SHARE_LINK_TO shareLinkTo; + /** * Instantiates a new geo na object. */ public GeoportalItemReferences() { } - + /** - * Instantiates a new geo na item ref. + * Instantiates a new geoportal item references. + * Backward compatibility. Use {{@link #GeoportalItemReferences(String, String, SHARE_LINK_TO)}} * * @param projectID the project ID * @param profileID the profile ID */ + @Deprecated public GeoportalItemReferences(String projectID, String profileID) { super(); this.projectID = projectID; this.profileID = profileID; } + /** + * Instantiates a new geo na item ref. + * + * @param projectID the project ID + * @param profileID the profile ID + * @param shareLinkTo the share link to + */ + public GeoportalItemReferences(String projectID, String profileID, SHARE_LINK_TO shareLinkTo) { + super(); + this.projectID = projectID; + this.profileID = profileID; + this.shareLinkTo = shareLinkTo; + } + /** * Instantiates a new geo na item ref. * @@ -95,6 +124,15 @@ public class GeoportalItemReferences implements Serializable { return itemName; } + /** + * Gets the share link to. + * + * @return the share link to + */ + public SHARE_LINK_TO getShareLinkTo() { + return shareLinkTo; + } + /** * Sets the item name. * @@ -160,8 +198,9 @@ public class GeoportalItemReferences implements Serializable { builder.append(openLink); builder.append(", layerObjectType="); builder.append(layerObjectType); + builder.append(", shareLinkTo="); + builder.append(shareLinkTo); builder.append("]"); return builder.toString(); } - } diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java b/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java index 8afe371..65c7c1a 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java @@ -10,18 +10,19 @@ package org.gcube.application.geoportalcommon.shared.config; */ public enum OPERATION_ON_ITEM { - CREATE_NEW_PROJECT("Create New Project"), - VIEW_PROJECT_AS_DOCUMENT("View Project as Document"), - VIEW_PROJECT_AS_JSON("View Projet as JSON"), - VIEW_ON_MAP("View on Map"), - VIEW_REPORT("View the Report"), - EDIT_PROJECT("Edit the Project"), - CLONE_PROJECT("Clone the Project"), - PUBLISH_UNPUBLISH_PROJECT("Publish/UnPublish the Project"), - DELETE_PROJECT("Delete the Project"), - CREATE_RELATION("Create Relation between two Projects"), - DELETE_RELATION("Delete Relation between two Projects"), - VIEW_RELATIONSHIPS("View the relationship/s created for the Project"); + CREATE_NEW_PROJECT("new", "Create New Project"), + VIEW_PROJECT_AS_DOCUMENT("vpd", "View Project as Document"), + VIEW_PROJECT_AS_JSON("vpj", "View Projet as JSON"), + VIEW_ON_MAP("vpm","View on Map"), + SHARE_PROJECT("shl","Share Project"), + VIEW_REPORT("vpr","View the Report"), + EDIT_PROJECT("edt","Edit the Project"), + CLONE_PROJECT("cln","Clone the Project"), + PUBLISH_UNPUBLISH_PROJECT("pup","Publish/UnPublish the Project"), + DELETE_PROJECT("dlt","Delete the Project"), + CREATE_RELATION("crr","Create Relation between two Projects"), + DELETE_RELATION("dlr","Delete Relation between two Projects"), + VIEW_RELATIONSHIPS("vpr", "View the relationship/s created for the Project"); String label; @@ -30,7 +31,7 @@ public enum OPERATION_ON_ITEM { * * @param label the label */ - OPERATION_ON_ITEM(String label){ + OPERATION_ON_ITEM(String id, String label){ this.label = label; } -- 2.17.1 From 4ca2a6b1bd1fae6e3405d9615df4e772aaf2c7b4 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 5 Apr 2024 15:57:32 +0200 Subject: [PATCH 3/8] renamed to GET_SHAREABLE_LINK --- .../geoportalcommon/shared/config/OPERATION_ON_ITEM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java b/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java index 65c7c1a..4f45f7f 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/config/OPERATION_ON_ITEM.java @@ -14,7 +14,7 @@ public enum OPERATION_ON_ITEM { VIEW_PROJECT_AS_DOCUMENT("vpd", "View Project as Document"), VIEW_PROJECT_AS_JSON("vpj", "View Projet as JSON"), VIEW_ON_MAP("vpm","View on Map"), - SHARE_PROJECT("shl","Share Project"), + GET_SHAREABLE_LINK("shl","Get Shareable Link"), VIEW_REPORT("vpr","View the Report"), EDIT_PROJECT("edt","Edit the Project"), CLONE_PROJECT("cln","Clone the Project"), -- 2.17.1 From 06b257fcf390cfe01a4870ffdc8e6d6206017d49 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 8 Apr 2024 17:18:54 +0200 Subject: [PATCH 4/8] - Added optional message when performing lifecycle step [#27192] --- CHANGELOG.md | 1 + .../geoportalcommon/geoportal/ProjectsCaller.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60628c7..1c86f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Search Filter for profileId and projectID [#27120] - Integrated new Uri-Resolver-Manager [#27160] - Added new operation "Share project" +- Added optional message when performing lifecycle step [#27192] ## [v2.3.0] diff --git a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index 43d989c..6696517 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java +++ b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java @@ -326,15 +326,16 @@ public class ProjectsCaller { * @param profileID the profile ID * @param projectID the project ID * @param stepID the step ID + * @param optionalMessage the optional message * @param options the options * @return the project * @throws Exception the exception */ - public Project performStep(String profileID, String projectID, String stepID, Document options) throws Exception { - LOG.info("performStep called for profileID: {}, projectID: {}", profileID, projectID); + public Project performStep(String profileID, String projectID, String stepID, String optionalMessage, Document options) throws Exception { + LOG.info("performStep called for profileID: {}, projectID: {}. Optional message exists?: {}", profileID, projectID, optionalMessage!=null); Projects client = (Projects) getClient(profileID); - StepExecutionRequest request = new StepExecutionRequest(stepID, options); - Project project = client.performStep(projectID, request); + StepExecutionRequest request = new StepExecutionRequest(stepID, optionalMessage, options); + Project project = client.performStep(projectID, optionalMessage, request); LOG.info("performStep returning project ID: " + project.getId()); return project; -- 2.17.1 From 05e9d3d42614b574affc1a17ac79e8208ae1ee8a Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 10 Apr 2024 17:18:27 +0200 Subject: [PATCH 5/8] indent --- .../java/org/gcube/application/se/RuntimeResourceReader.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/org/gcube/application/se/RuntimeResourceReader.java b/src/test/java/org/gcube/application/se/RuntimeResourceReader.java index 4ce47d2..94f0a48 100644 --- a/src/test/java/org/gcube/application/se/RuntimeResourceReader.java +++ b/src/test/java/org/gcube/application/se/RuntimeResourceReader.java @@ -151,9 +151,7 @@ public class RuntimeResourceReader { // String platformName = "postgis"; // String category = "Database"; - // scope = "/pred4s/preprod/preVRE"; - RuntimeResourceReader reader; try { ScopeProvider.instance.set(scope); -- 2.17.1 From ad646a8bf9076bc01ef4748c7f384f49d84ced4d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 11 Apr 2024 09:49:36 +0200 Subject: [PATCH 6/8] removed optionalMessage as parameter and added into StepExecutionRequest bean --- .../application/geoportalcommon/geoportal/ProjectsCaller.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index 6696517..cc5ac1f 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java +++ b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java @@ -335,7 +335,7 @@ public class ProjectsCaller { LOG.info("performStep called for profileID: {}, projectID: {}. Optional message exists?: {}", profileID, projectID, optionalMessage!=null); Projects client = (Projects) getClient(profileID); StepExecutionRequest request = new StepExecutionRequest(stepID, optionalMessage, options); - Project project = client.performStep(projectID, optionalMessage, request); + Project project = client.performStep(projectID, request); LOG.info("performStep returning project ID: " + project.getId()); return project; -- 2.17.1 From 3174b8f9378cfb9b3c2fc15e6f2006766e8abaf0 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 11 Apr 2024 11:04:09 +0200 Subject: [PATCH 7/8] added new bean StepPerformedResultDV --- .../geoportal/step/StepPerformedResultDV.java | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/step/StepPerformedResultDV.java diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/step/StepPerformedResultDV.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/step/StepPerformedResultDV.java new file mode 100644 index 0000000..f770392 --- /dev/null +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/step/StepPerformedResultDV.java @@ -0,0 +1,119 @@ +package org.gcube.application.geoportalcommon.shared.geoportal.step; + +import java.io.Serializable; + +import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; + + +/** + * The Class StepPerformedResultDV. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Apr 11, 2024 + */ +public class StepPerformedResultDV implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7065890375433142728L; + + private String projectId; + private String profileID; + private LifecycleInformationDV lifecycleInfoDV; + + /** + * Instantiates a new step performed result DV. + */ + public StepPerformedResultDV() { + } + + + /** + * Instantiates a new step performed result DV. + * + * @param profileID the profile ID + * @param projectId the project id + * @param lifecycleInfoDV the lifecycle info DV + */ + public StepPerformedResultDV(String profileID, String projectId, LifecycleInformationDV lifecycleInfoDV) { + super(); + this.projectId = projectId; + this.profileID = profileID; + this.lifecycleInfoDV = lifecycleInfoDV; + } + + /** + * Gets the project id. + * + * @return the project id + */ + public String getProjectId() { + return projectId; + } + + /** + * Gets the profile ID. + * + * @return the profile ID + */ + public String getProfileID() { + return profileID; + } + + /** + * Gets the lifecycle info DV. + * + * @return the lifecycle info DV + */ + public LifecycleInformationDV getLifecycleInfoDV() { + return lifecycleInfoDV; + } + + /** + * Sets the project id. + * + * @param projectId the new project id + */ + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + /** + * Sets the profile ID. + * + * @param profileID the new profile ID + */ + public void setProfileID(String profileID) { + this.profileID = profileID; + } + + /** + * Sets the lifecycle info DV. + * + * @param lifecycleInfoDV the new lifecycle info DV + */ + public void setLifecycleInfoDV(LifecycleInformationDV lifecycleInfoDV) { + this.lifecycleInfoDV = lifecycleInfoDV; + } + + /** + * To string. + * + * @return the string + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("StepPerformedResultDV [projectId="); + builder.append(projectId); + builder.append(", profileID="); + builder.append(profileID); + builder.append(", lifecycleInfoDV="); + builder.append(lifecycleInfoDV); + builder.append("]"); + return builder.toString(); + } + +} -- 2.17.1 From 4923b9656f265f526cfe1c0bc16c4596f652f001 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 15 Apr 2024 12:33:53 +0200 Subject: [PATCH 8/8] updated to PerformStepRequest --- .../application/geoportalcommon/geoportal/ProjectsCaller.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index cc5ac1f..087532d 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java +++ b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java @@ -21,12 +21,12 @@ import org.gcube.application.geoportal.common.model.document.Project; import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject; import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest; import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest; +import org.gcube.application.geoportal.common.model.rest.PerformStepRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction; import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; -import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.rest.Projects; import org.gcube.application.geoportal.common.utils.FileSets; import org.gcube.application.geoportal.common.utils.StorageUtils; @@ -334,7 +334,7 @@ public class ProjectsCaller { public Project performStep(String profileID, String projectID, String stepID, String optionalMessage, Document options) throws Exception { LOG.info("performStep called for profileID: {}, projectID: {}. Optional message exists?: {}", profileID, projectID, optionalMessage!=null); Projects client = (Projects) getClient(profileID); - StepExecutionRequest request = new StepExecutionRequest(stepID, optionalMessage, options); + PerformStepRequest request = new PerformStepRequest(stepID, optionalMessage, options); Project project = client.performStep(projectID, request); LOG.info("performStep returning project ID: " + project.getId()); -- 2.17.1