Updated Paths

This commit is contained in:
Francesco Mangiacrapa 2023-03-24 14:00:24 +01:00
parent a70c7b5f10
commit f6004df3db
2 changed files with 22 additions and 14 deletions

View File

@ -7,6 +7,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.gcube.datatransfer.resolver.services.GeoportalResolver;
/**
* The Enum TargetAppGeoportalCodes.
*
@ -16,8 +18,9 @@ import java.util.stream.Collectors;
*/
public enum TargetAppGeoportalCodes {
GEO("geo", "geoportal", "Geoportal"), GEO_DV("geo-dv", "data-viewer", "Geoportal Viewer"),
GEO_DE("geo-de", "data-entry", "Geoportal Entry");
GEO(GeoportalResolver.GEO, "geoportal", "Geoportal"),
GEO_DV(GeoportalResolver.GEO_DV, "data-viewer", "Geoportal Viewer"),
GEO_DE(GeoportalResolver.GEO_DE, "data-entry", "Geoportal Entry");
private String id; // the code id
private String name; // the code value

View File

@ -49,11 +49,16 @@ import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
@Path("")
public class GeoportalResolver {
public static final String GEO_DE = "geo-de";
public static final String GEO = "geo";
public static final String GEO_DV = "geo-dv";
private static final String QP_RESOLVE_AS = "res";
private static final String PATH_PROJECT_ID = "project_id";
private static final String PATH_USECASE_ID = "usecase_id";
private static final String PATH_VRE_NAME = "vre_name";
private static final String PATH_TARGET_APP = "targetAppId";
private static final Logger LOG = LoggerFactory.getLogger(GeoportalResolver.class);
private static String helpURI = "https://wiki.gcube-system.org/gcube/URI_Resolver#Geoportal_Resolver";
@ -80,11 +85,11 @@ public class GeoportalResolver {
* @throws WebApplicationException the web application exception
*/
@GET
@Path("geo/{vre_name}/{usecase_id}/{project_id}")
@Path(GEO+"/{vre_name}/{usecase_id}/{project_id}")
public Response resolveGeoportal(@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 {
String targetAppId = "geo";
String targetAppId = GEO;
return genericGet(req, targetAppId, vreName, ucdID, projectID, resolveAs);
}
@ -101,11 +106,11 @@ public class GeoportalResolver {
* @throws WebApplicationException the web application exception
*/
@GET
@Path("geo-dv/{vre_name}/{usecase_id}/{project_id}")
@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 {
String targetAppId = "geo-dv";
String targetAppId = GEO_DV;
return genericGet(req, targetAppId, vreName, ucdID, projectID, resolveAs);
}
@ -122,11 +127,11 @@ public class GeoportalResolver {
* @throws WebApplicationException the web application exception
*/
@GET
@Path("geo-de/{vre_name}/{usecase_id}/{project_id}")
@Path(GEO_DE+"/{vre_name}/{usecase_id}/{project_id}")
public Response resolveGeoportalDE(@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 {
String targetAppId = "geo-de";
String targetAppId = GEO_DE;
return genericGet(req, targetAppId, vreName, ucdID, projectID, resolveAs);
}
@ -140,12 +145,12 @@ public class GeoportalResolver {
* @throws WebApplicationException the web application exception
*/
@POST
@Path("geo")
@Path(GEO)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response postGeoportal(@Context HttpServletRequest req, GeoportalRequest jsonRequest) throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " POST starts...");
String targetAppId = "geo";
String targetAppId = GEO;
return genericPost(req, jsonRequest, targetAppId);
}
@ -157,12 +162,12 @@ public class GeoportalResolver {
* @return the response
* @throws WebApplicationException the web application exception
*/
@Path("geo-dv")
@Path(GEO_DV)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response postGeoportalDV(@Context HttpServletRequest req, GeoportalRequest jsonRequest) throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " POST starts...");
String targetAppId = "geo-dv";
String targetAppId = GEO_DV;
return genericPost(req, jsonRequest, targetAppId);
}
@ -174,12 +179,12 @@ public class GeoportalResolver {
* @return the response
* @throws WebApplicationException the web application exception
*/
@Path("geo-de")
@Path(GEO_DE)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response postGeoportalDE(@Context HttpServletRequest req, GeoportalRequest jsonRequest) throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " POST starts...");
String targetAppId = "geo-de";
String targetAppId = GEO_DE;
return genericPost(req, jsonRequest, targetAppId);
}