Updated Paths

This commit is contained in:
Francesco Mangiacrapa 2023-03-24 15:54:40 +01:00
parent de4b608051
commit d4862b88d6
3 changed files with 18 additions and 36 deletions

View File

@ -18,15 +18,12 @@ import lombok.extern.slf4j.Slf4j;
public class GeoportalRequest { public class GeoportalRequest {
public static final String P_GCUBE_SCOPE = "gcube_scope"; 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_TYPE = "item_type";
public static final String P_ITEM_ID = "item_id"; public static final String P_ITEM_ID = "item_id";
public static final String P_QUERY_STRING = "query_string"; public static final String P_QUERY_STRING = "query_string";
@JsonProperty(P_GCUBE_SCOPE) @JsonProperty(P_GCUBE_SCOPE)
private String gcubeScope; private String gcubeScope;
@JsonProperty(P_TARGET_APP)
private String targetAppName;
/** /**
* It is the UCD ID {usecase_id} * It is the UCD ID {usecase_id}
*/ */

View File

@ -18,7 +18,6 @@ import org.gcube.datatransfer.resolver.services.GeoportalResolver;
*/ */
public enum TargetAppGeoportalCodes { public enum TargetAppGeoportalCodes {
GEO(GeoportalResolver.GEO, "geoportal", "Geoportal"),
GEO_DV(GeoportalResolver.GEO_DV, "data-viewer", "Geoportal Viewer"), GEO_DV(GeoportalResolver.GEO_DV, "data-viewer", "Geoportal Viewer"),
GEO_DE(GeoportalResolver.GEO_DE, "data-entry", "Geoportal Entry"); GEO_DE(GeoportalResolver.GEO_DE, "data-entry", "Geoportal Entry");

View File

@ -49,9 +49,9 @@ import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
@Path("/geo") @Path("/geo")
public class GeoportalResolver { public class GeoportalResolver {
public static final String GEO_DE = "de"; public static final String GEO_DE = "de"; //data-entry
public static final String GEO = "geo"; public static final String GEO = "geo"; //geoportal
public static final String GEO_DV = "dv"; public static final String GEO_DV = "dv"; //data-viewer
private static final String QP_RESOLVE_AS = "res"; private static final String QP_RESOLVE_AS = "res";
private static final String PATH_PROJECT_ID = "project_id"; private static final String PATH_PROJECT_ID = "project_id";
@ -73,21 +73,6 @@ public class GeoportalResolver {
PUBLIC, PRIVATE 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 @GET
@Path("/{targetAppId}/{vre_name}/{usecase_id}/{project_id}") @Path("/{targetAppId}/{vre_name}/{usecase_id}/{project_id}")
public Response resolveGeoportal(@Context HttpServletRequest req, @PathParam(PATH_TARGET_APP) String targetAppId, 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 req the req
* @param vreName the vre name * @param targetAppId the target app id
* @param ucdID the ucd ID * @param jsonRequest the json request
* @param projectID the project ID
* @param resolveAs the resolve as
* @return the response * @return the response
* @throws WebApplicationException the web application exception * @throws WebApplicationException the web application exception
*/ */
@GET @POST
@Path("/" + GEO_DV + "/{vre_name}/{usecase_id}/{project_id}") @Path("")
public Response resolveGeoportalDV(@Context HttpServletRequest req, @PathParam(PATH_VRE_NAME) String vreName, @Consumes(MediaType.APPLICATION_JSON)
@PathParam(PATH_USECASE_ID) String ucdID, @PathParam(PATH_PROJECT_ID) String projectID, @Produces(MediaType.TEXT_PLAIN)
@QueryParam(QP_RESOLVE_AS) String resolveAs) throws WebApplicationException { public Response postGeoportalNoAppDef(@Context HttpServletRequest req, GeoportalRequest jsonRequest)
TargetAppGeoportalCodes targetAppGeoportalCodes = TargetAppGeoportalCodes.GEO_DV; throws WebApplicationException {
return genericGet(req, targetAppGeoportalCodes, vreName, ucdID, projectID, resolveAs); 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);
} }
/** /**