diff --git a/CHANGELOG.md b/CHANGELOG.md index 7223704..1c86f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ 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] +- Integrated new Uri-Resolver-Manager [#27160] +- Added new operation "Share project" +- Added optional message when performing lifecycle step [#27192] + ## [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/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/geoportal/ProjectsCaller.java b/src/main/java/org/gcube/application/geoportalcommon/geoportal/ProjectsCaller.java index 43d989c..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; @@ -326,14 +326,15 @@ 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); + PerformStepRequest request = new PerformStepRequest(stepID, optionalMessage, options); Project project = client.performStep(projectID, request); LOG.info("performStep returning project ID: " + project.getId()); 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/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(); } - } 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..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 @@ -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"), + 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"), + 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; } 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(); + } + +} 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);