feature_27120 #11

Merged
francesco.mangiacrapa merged 8 commits from feature_27120 into master 2024-06-28 15:51:22 +02:00
9 changed files with 229 additions and 24 deletions

View File

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. 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). 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] ## [v2.3.0]
- Read countByPhase from configuration [#25598] - Read countByPhase from configuration [#25598]

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId> <artifactId>geoportal-data-common</artifactId>
<version>2.3.0</version> <version>2.4.0-SNAPSHOT</version>
<description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description> <description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description>
<scm> <scm>

View File

@ -8,10 +8,12 @@ import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; 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.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager; 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;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.GeoportalResolverQueryStringBuilder.RESOLVE_AS; 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.gcube.portlets.user.urlshortener.UrlShortener;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -65,6 +67,24 @@ public class GeoportalCommon {
item.getProjectID()); item.getProjectID());
builder.scope(gcubeScope); builder.scope(gcubeScope);
builder.resolverAs(RESOLVE_AS.PRIVATE); 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); // builder.resolverAs(RESOLVE_AS.PRIVATE);
Map<String, String> params = builder.buildQueryParameters(); Map<String, String> params = builder.buildQueryParameters();
String link = resolver.getLink(params, false); String link = resolver.getLink(params, false);

View File

@ -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.document.relationships.RelationshipNavigationObject;
import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest; 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.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;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest; 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.OrderedRequest.Direction;
import org.gcube.application.geoportal.common.model.rest.QueryRequest.PagedRequest; 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.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.rest.Projects; import org.gcube.application.geoportal.common.rest.Projects;
import org.gcube.application.geoportal.common.utils.FileSets; import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
@ -326,14 +326,15 @@ public class ProjectsCaller {
* @param profileID the profile ID * @param profileID the profile ID
* @param projectID the project ID * @param projectID the project ID
* @param stepID the step ID * @param stepID the step ID
* @param optionalMessage the optional message
* @param options the options * @param options the options
* @return the project * @return the project
* @throws Exception the exception * @throws Exception the exception
*/ */
public Project performStep(String profileID, String projectID, String stepID, Document options) throws Exception { public Project performStep(String profileID, String projectID, String stepID, String optionalMessage, Document options) throws Exception {
LOG.info("performStep called for profileID: {}, projectID: {}", profileID, projectID); LOG.info("performStep called for profileID: {}, projectID: {}. Optional message exists?: {}", profileID, projectID, optionalMessage!=null);
Projects<Project> client = (Projects<Project>) getClient(profileID); Projects<Project> client = (Projects<Project>) getClient(profileID);
StepExecutionRequest request = new StepExecutionRequest(stepID, options); PerformStepRequest request = new PerformStepRequest(stepID, optionalMessage, options);
Project project = client.performStep(projectID, request); Project project = client.performStep(projectID, request);
LOG.info("performStep returning project ID: " + project.getId()); LOG.info("performStep returning project ID: " + project.getId());

View File

@ -16,6 +16,17 @@ public class GeoportalItemReferences implements Serializable {
*/ */
private static final long serialVersionUID = -7021431511279022193L; 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 // this is the mongoID
private String projectID; private String projectID;
private String profileID; // this is the profileID - UCD private String profileID; // this is the profileID - UCD
@ -26,25 +37,43 @@ public class GeoportalItemReferences implements Serializable {
private String layerObjectType; private String layerObjectType;
private SHARE_LINK_TO shareLinkTo;
/** /**
* Instantiates a new geo na object. * Instantiates a new geo na object.
*/ */
public GeoportalItemReferences() { 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 projectID the project ID
* @param profileID the profile ID * @param profileID the profile ID
*/ */
@Deprecated
public GeoportalItemReferences(String projectID, String profileID) { public GeoportalItemReferences(String projectID, String profileID) {
super(); super();
this.projectID = projectID; this.projectID = projectID;
this.profileID = profileID; 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. * Instantiates a new geo na item ref.
* *
@ -95,6 +124,15 @@ public class GeoportalItemReferences implements Serializable {
return itemName; return itemName;
} }
/**
* Gets the share link to.
*
* @return the share link to
*/
public SHARE_LINK_TO getShareLinkTo() {
return shareLinkTo;
}
/** /**
* Sets the item name. * Sets the item name.
* *
@ -160,8 +198,9 @@ public class GeoportalItemReferences implements Serializable {
builder.append(openLink); builder.append(openLink);
builder.append(", layerObjectType="); builder.append(", layerObjectType=");
builder.append(layerObjectType); builder.append(layerObjectType);
builder.append(", shareLinkTo=");
builder.append(shareLinkTo);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -90,6 +90,10 @@ public class SearchingFilter implements Serializable {
private LinkedHashMap<String, Object> projection; private LinkedHashMap<String, Object> projection;
private String profileID;
private String projectID;
/** /**
* Instantiates a new sort filter. * Instantiates a new sort filter.
*/ */
@ -180,6 +184,19 @@ public class SearchingFilter implements Serializable {
this.orderByFields = orderByFields; 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. * Sets the order.
* *
@ -200,8 +217,11 @@ public class SearchingFilter implements Serializable {
builder.append(conditions); builder.append(conditions);
builder.append(", projection="); builder.append(", projection=");
builder.append(projection); builder.append(projection);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -10,18 +10,19 @@ package org.gcube.application.geoportalcommon.shared.config;
*/ */
public enum OPERATION_ON_ITEM { public enum OPERATION_ON_ITEM {
CREATE_NEW_PROJECT("Create New Project"), CREATE_NEW_PROJECT("new", "Create New Project"),
VIEW_PROJECT_AS_DOCUMENT("View Project as Document"), VIEW_PROJECT_AS_DOCUMENT("vpd", "View Project as Document"),
VIEW_PROJECT_AS_JSON("View Projet as JSON"), VIEW_PROJECT_AS_JSON("vpj", "View Projet as JSON"),
VIEW_ON_MAP("View on Map"), VIEW_ON_MAP("vpm","View on Map"),
VIEW_REPORT("View the Report"), GET_SHAREABLE_LINK("shl","Get Shareable Link"),
EDIT_PROJECT("Edit the Project"), VIEW_REPORT("vpr","View the Report"),
CLONE_PROJECT("Clone the Project"), EDIT_PROJECT("edt","Edit the Project"),
PUBLISH_UNPUBLISH_PROJECT("Publish/UnPublish the Project"), CLONE_PROJECT("cln","Clone the Project"),
DELETE_PROJECT("Delete the Project"), PUBLISH_UNPUBLISH_PROJECT("pup","Publish/UnPublish the Project"),
CREATE_RELATION("Create Relation between two Projects"), DELETE_PROJECT("dlt","Delete the Project"),
DELETE_RELATION("Delete Relation between two Projects"), CREATE_RELATION("crr","Create Relation between two Projects"),
VIEW_RELATIONSHIPS("View the relationship/s created for the Project"); DELETE_RELATION("dlr","Delete Relation between two Projects"),
VIEW_RELATIONSHIPS("vpr", "View the relationship/s created for the Project");
String label; String label;
@ -30,7 +31,7 @@ public enum OPERATION_ON_ITEM {
* *
* @param label the label * @param label the label
*/ */
OPERATION_ON_ITEM(String label){ OPERATION_ON_ITEM(String id, String label){
this.label = label; this.label = label;
} }

View File

@ -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();
}
}

View File

@ -151,9 +151,7 @@ public class RuntimeResourceReader {
// String platformName = "postgis"; // String platformName = "postgis";
// String category = "Database"; // String category = "Database";
// scope = "/pred4s/preprod/preVRE"; // scope = "/pred4s/preprod/preVRE";
RuntimeResourceReader reader; RuntimeResourceReader reader;
try { try {
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);