From d4862b88d6eb88e48abca0579fbd6cefbb04a7bb Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 24 Mar 2023 15:54:40 +0100 Subject: [PATCH] Updated Paths --- .../resolver/geoportal/GeoportalRequest.java | 3 -- .../geoportal/TargetAppGeoportalCodes.java | 1 - .../resolver/services/GeoportalResolver.java | 50 +++++++------------ 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/gcube/datatransfer/resolver/geoportal/GeoportalRequest.java b/src/main/java/org/gcube/datatransfer/resolver/geoportal/GeoportalRequest.java index 21e3790..3bf4206 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/geoportal/GeoportalRequest.java +++ b/src/main/java/org/gcube/datatransfer/resolver/geoportal/GeoportalRequest.java @@ -18,15 +18,12 @@ import lombok.extern.slf4j.Slf4j; public class GeoportalRequest { public static final String P_GCUBE_SCOPE = "gcube_scope"; - public static final String P_TARGET_APP = "target_app_name"; public static final String P_ITEM_TYPE = "item_type"; public static final String P_ITEM_ID = "item_id"; public static final String P_QUERY_STRING = "query_string"; @JsonProperty(P_GCUBE_SCOPE) private String gcubeScope; - @JsonProperty(P_TARGET_APP) - private String targetAppName; /** * It is the UCD ID {usecase_id} */ diff --git a/src/main/java/org/gcube/datatransfer/resolver/geoportal/TargetAppGeoportalCodes.java b/src/main/java/org/gcube/datatransfer/resolver/geoportal/TargetAppGeoportalCodes.java index d544e54..2e074ca 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/geoportal/TargetAppGeoportalCodes.java +++ b/src/main/java/org/gcube/datatransfer/resolver/geoportal/TargetAppGeoportalCodes.java @@ -18,7 +18,6 @@ import org.gcube.datatransfer.resolver.services.GeoportalResolver; */ public enum TargetAppGeoportalCodes { - GEO(GeoportalResolver.GEO, "geoportal", "Geoportal"), GEO_DV(GeoportalResolver.GEO_DV, "data-viewer", "Geoportal Viewer"), GEO_DE(GeoportalResolver.GEO_DE, "data-entry", "Geoportal Entry"); diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalResolver.java index 4b87303..529191b 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/GeoportalResolver.java @@ -49,9 +49,9 @@ import com.google.common.cache.CacheLoader.InvalidCacheLoadException; @Path("/geo") public class GeoportalResolver { - public static final String GEO_DE = "de"; - public static final String GEO = "geo"; - public static final String GEO_DV = "dv"; + public static final String GEO_DE = "de"; //data-entry + public static final String GEO = "geo"; //geoportal + public static final String GEO_DV = "dv"; //data-viewer private static final String QP_RESOLVE_AS = "res"; private static final String PATH_PROJECT_ID = "project_id"; @@ -73,21 +73,6 @@ public class GeoportalResolver { PUBLIC, PRIVATE } - /** - * Resolve geoportal. - * - * @param req the req - * @param targetAppId the target app id - * @param vreName the vre name - * @param ucdID the ucd ID - * @param projectID the project ID - * @param resolveAs the resolve as - * @return the response - * @throws WebApplicationException the web application - * exception @Path("/{targetAppId:" + GEO + "|" - * + GEO_DV + "|" + GEO_DE + "}" + - * "/{vre_name}/{usecase_id}/{project_id}") - */ @GET @Path("/{targetAppId}/{vre_name}/{usecase_id}/{project_id}") public Response resolveGeoportal(@Context HttpServletRequest req, @PathParam(PATH_TARGET_APP) String targetAppId, @@ -102,24 +87,25 @@ public class GeoportalResolver { } /** - * Resolve geoportal DV. + * Create a Catalogue Link. * - * @param req the req - * @param vreName the vre name - * @param ucdID the ucd ID - * @param projectID the project ID - * @param resolveAs the resolve as + * @param req the req + * @param targetAppId the target app id + * @param jsonRequest the json request * @return the response * @throws WebApplicationException the web application exception */ - @GET - @Path("/" + GEO_DV + "/{vre_name}/{usecase_id}/{project_id}") - public Response resolveGeoportalDV(@Context HttpServletRequest req, @PathParam(PATH_VRE_NAME) String vreName, - @PathParam(PATH_USECASE_ID) String ucdID, @PathParam(PATH_PROJECT_ID) String projectID, - @QueryParam(QP_RESOLVE_AS) String resolveAs) throws WebApplicationException { - TargetAppGeoportalCodes targetAppGeoportalCodes = TargetAppGeoportalCodes.GEO_DV; - return genericGet(req, targetAppGeoportalCodes, vreName, ucdID, projectID, resolveAs); - + @POST + @Path("") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) + public Response postGeoportalNoAppDef(@Context HttpServletRequest req, GeoportalRequest jsonRequest) + throws WebApplicationException { + LOG.info(this.getClass().getSimpleName() + " POST starts..."); + // String targetAppId = GEO; + TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null); + LOG.info("The target app is: " + targetAppGeoportalCodes); + return genericPost(req, jsonRequest, targetAppGeoportalCodes); } /**