Class GeoportalExporter
- java.lang.Object
-
- org.gcube.datatransfer.resolver.services.GeoportalExporter
-
@Path("geoportal") public class GeoportalExporter extends ObjectThe Class GeoportalExporter. The Geoportal Exporter provides the facilities to export GIS projects stored in the Geoportal system provided via D4Science VREs.- Author:
- Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it Apr 16, 2024
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGeoportalExporter.ACCEPTED_EXPORT_TYPEThe Enum ACCEPTED_EXPORT_TYPE.
-
Field Summary
Fields Modifier and Type Field Description static StringEXPORT_TYPEstatic StringPATH_PROJECT_IDstatic StringPATH_USECASE_IDstatic StringPATH_VRE_NAMEstatic StringQUERY_PARAMETER_AS_URL
-
Constructor Summary
Constructors Constructor Description GeoportalExporter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GeoportalExporter.ACCEPTED_EXPORT_TYPEcheckExportType(javax.servlet.http.HttpServletRequest req, String export_type)Check export type.voidcheckPathParameterNotNull(javax.servlet.http.HttpServletRequest req, String parameter, String value)Check path parameter not null.javax.ws.rs.core.Responseexport(javax.servlet.http.HttpServletRequest req, String export_type, String ucdID, String projectID, String asURL)Export.org.gcube.application.geoportaldatamapper.shared.FileReferenceexportAsPDF(javax.servlet.http.HttpServletRequest req, String profileID, String projectID, String profileTitle, String context, org.gcube.common.authorization.utils.user.User user)Export as PDF.org.gcube.application.geoportalcommon.shared.GeoportalItemReferencesgetPublicLinksFor(org.gcube.application.geoportalcommon.shared.GeoportalItemReferences item, String context)Gets the public links for.javax.ws.rs.core.Responsehealthcheck(javax.servlet.http.HttpServletRequest req, String export_type)Healthcheck.StringresponseToString(GeoportalJsonResponse jsonResponse)javax.ws.rs.core.ResponseviewJob(javax.servlet.http.HttpServletRequest req, String jobCode)View job.
-
-
-
Field Detail
-
EXPORT_TYPE
public static final String EXPORT_TYPE
- See Also:
- Constant Field Values
-
PATH_PROJECT_ID
public static final String PATH_PROJECT_ID
- See Also:
- Constant Field Values
-
PATH_USECASE_ID
public static final String PATH_USECASE_ID
- See Also:
- Constant Field Values
-
PATH_VRE_NAME
public static final String PATH_VRE_NAME
- See Also:
- Constant Field Values
-
QUERY_PARAMETER_AS_URL
public static final String QUERY_PARAMETER_AS_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
export
@GET @Path("/export/{type}/{usecase_id}/{project_id}") @Produces({"text/html","text/plain","application/octet-stream"}) public javax.ws.rs.core.Response export(@Context javax.servlet.http.HttpServletRequest req, @PathParam("type") String export_type, @PathParam("usecase_id") String ucdID, @PathParam("project_id") String projectID, @QueryParam("as-url") @Nullable String asURL) throws javax.ws.rs.WebApplicationExceptionExport.- Parameters:
req- the reqexport_type- the export type. Must be a value of the enum {#ACCEPTED_EXPORT_TYPE}ucdID- the ucd IDprojectID- the project IDasURL- the as URL. If true returns the project exported as an URL in the response- Returns:
- the response. Can be an URL or a Stream of the project exported.
- Throws:
javax.ws.rs.WebApplicationException- the web application exception
-
healthcheck
@GET @Path("/export/{type}/healthcheck") @Produces({"application/json","text/plain","text/html"}) public javax.ws.rs.core.Response healthcheck(@Context javax.servlet.http.HttpServletRequest req, @PathParam("type") String export_type) throws javax.ws.rs.WebApplicationExceptionHealthcheck. Checks if the export facility is configured in the context (i.e. the scope read from input token).- Parameters:
req- the reqexport_type- the export type- Returns:
- an object of type {#GeoportalJsonResponse) that contains the response
- Throws:
javax.ws.rs.WebApplicationException- the web application exception
-
viewJob
@GET @Path("/view/{jobCode}") @Produces({"application/json","text/html","text/plain"}) public javax.ws.rs.core.Response viewJob(@Context javax.servlet.http.HttpServletRequest req, @PathParam("jobCode") String jobCode) throws javax.ws.rs.WebApplicationExceptionView job. Check the job export status.- Parameters:
req- the reqjobCode- the job code. The job ID assigned by export facility that returns a waiting HTML page- Returns:
- the response. It is a {#GeoportalJsonResponse} with the status of the job. An export job completed contains the URL of the project exported.
- Throws:
javax.ws.rs.WebApplicationException- the web application exception
-
responseToString
public String responseToString(GeoportalJsonResponse jsonResponse) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException
-
checkPathParameterNotNull
public void checkPathParameterNotNull(javax.servlet.http.HttpServletRequest req, String parameter, String value) throws BadRequestExceptionCheck path parameter not null.- Parameters:
req- the reqparameter- the parametervalue- the value- Throws:
BadRequestException- the bad request exception
-
checkExportType
public GeoportalExporter.ACCEPTED_EXPORT_TYPE checkExportType(javax.servlet.http.HttpServletRequest req, String export_type) throws BadRequestException
Check export type.- Parameters:
req- the reqexport_type- the export type- Returns:
- the accepted export type
- Throws:
BadRequestException- the bad request exception
-
exportAsPDF
public org.gcube.application.geoportaldatamapper.shared.FileReference exportAsPDF(javax.servlet.http.HttpServletRequest req, String profileID, String projectID, String profileTitle, String context, org.gcube.common.authorization.utils.user.User user) throws javax.ws.rs.WebApplicationExceptionExport as PDF.- Parameters:
req- the reqprofileID- the profile IDprojectID- the project IDprofileTitle- the profile titlecontext- the contextuser- the user- Returns:
- the file reference
- Throws:
javax.ws.rs.WebApplicationException- the web application exception
-
getPublicLinksFor
public org.gcube.application.geoportalcommon.shared.GeoportalItemReferences getPublicLinksFor(org.gcube.application.geoportalcommon.shared.GeoportalItemReferences item, String context) throws ExceptionGets the public links for.- Parameters:
item- the itemcontext- the context- Returns:
- the public links for
- Throws:
Exception- the exception
-
-