Paths Updated

This commit is contained in:
Francesco Mangiacrapa 2023-03-24 16:05:02 +01:00
parent d4862b88d6
commit 4ba61bf232
1 changed files with 49 additions and 14 deletions

View File

@ -49,9 +49,9 @@ import com.google.common.cache.CacheLoader.InvalidCacheLoadException;
@Path("/geo")
public class GeoportalResolver {
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
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,13 +73,51 @@ 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
*/
@GET
@Path("/{vre_name}/{usecase_id}/{project_id}")
public Response resolveGeoportalNoAppDef(@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 {
LOG.info(this.getClass().getSimpleName() + " resolveGeoportalNoAppDef - GET starts...");
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
LOG.info("The target app is: " + targetAppGeoportalCodes);
return genericGet(req, targetAppGeoportalCodes, vreName, ucdID, projectID, resolveAs);
}
/**
* 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
*/
@GET
@Path("/{targetAppId}/{vre_name}/{usecase_id}/{project_id}")
public Response resolveGeoportal(@Context HttpServletRequest req, @PathParam(PATH_TARGET_APP) String targetAppId,
@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;
LOG.info(this.getClass().getSimpleName() + " resolveGeoportal - GET starts...");
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, targetAppId);
LOG.info("The target app is: " + targetAppGeoportalCodes);
return genericGet(req, targetAppGeoportalCodes, vreName, ucdID, projectID, resolveAs);
@ -87,10 +125,9 @@ public class GeoportalResolver {
}
/**
* Create a Catalogue Link.
* Post geoportal no app def.
*
* @param req the req
* @param targetAppId the target app id
* @param jsonRequest the json request
* @return the response
* @throws WebApplicationException the web application exception
@ -101,8 +138,8 @@ public class GeoportalResolver {
@Produces(MediaType.TEXT_PLAIN)
public Response postGeoportalNoAppDef(@Context HttpServletRequest req, GeoportalRequest jsonRequest)
throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " POST starts...");
// String targetAppId = GEO;
LOG.info(this.getClass().getSimpleName() + " postGeoportalNoAppDef - POST starts...");
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
LOG.info("The target app is: " + targetAppGeoportalCodes);
return genericPost(req, jsonRequest, targetAppGeoportalCodes);
@ -123,8 +160,8 @@ public class GeoportalResolver {
@Produces(MediaType.TEXT_PLAIN)
public Response postGeoportal(@Context HttpServletRequest req, @PathParam(PATH_TARGET_APP) String targetAppId,
GeoportalRequest jsonRequest) throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " POST starts...");
// String targetAppId = GEO;
LOG.info(this.getClass().getSimpleName() + " postGeoportal - POST starts...");
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, targetAppId);
LOG.info("The target app is: " + targetAppGeoportalCodes);
return genericPost(req, jsonRequest, targetAppGeoportalCodes);
@ -180,8 +217,6 @@ public class GeoportalResolver {
@PathParam(PATH_PROJECT_ID) String projectID, @QueryParam(QP_RESOLVE_AS) String resolveAs)
throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " GET starts...");
try {
InnerMethodName.instance.set("resolveGeoportalPublicLink");
@ -391,8 +426,8 @@ public class GeoportalResolver {
"The scope '" + scope + "' does not matching any scope in the infrastructure. Is it valid?",
this.getClass(), helpURI);
String linkURL = String.format("%s/%s%s/%s/%s/%s", serverUrl, GEO, targetAppGeoportalCodes.getId(), vreName,
jsonRequest.getItemType(), jsonRequest.getItemID());
String linkURL = String.format("%s/%s/%s/%s/%s/%s", serverUrl, GEO, targetAppGeoportalCodes.getId(),
vreName, jsonRequest.getItemType(), jsonRequest.getItemID());
if (jsonRequest.getQueryString() != null) {
linkURL += "?" + jsonRequest.getQueryString();