renamed pdfCode to jobCode

This commit is contained in:
Francesco Mangiacrapa 2024-04-22 17:36:07 +02:00
parent 0263fd2235
commit 40f417c90b
1 changed files with 10 additions and 10 deletions

View File

@ -262,21 +262,21 @@ public class GeoportalExporter {
* View job. * View job.
* *
* @param req the req * @param req the req
* @param pdfCode the pdf code * @param jobCode the job code
* @return the response * @return the response
* @throws WebApplicationException the web application exception * @throws WebApplicationException the web application exception
*/ */
@GET @GET
@Path("/view/{jobCode}") @Path("/view/{jobCode}")
@Produces({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) @Produces({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML })
public Response viewJob(@Context HttpServletRequest req, @PathParam(JOB_CODE) String pdfCode) public Response viewJob(@Context HttpServletRequest req, @PathParam(JOB_CODE) String jobCode)
throws WebApplicationException { throws WebApplicationException {
LOG.info(this.getClass().getSimpleName() + " viewPDF - GET starts..."); LOG.info(this.getClass().getSimpleName() + " viewPDF - GET starts...");
LOG.info("viewJob param " + JOB_CODE + ": {}", pdfCode); LOG.info("viewJob param " + JOB_CODE + ": {}", jobCode);
FetchPDF fetchedPDF = map.get(pdfCode); FetchPDF fetchedPDF = map.get(jobCode);
LOG.info("viewJob FileReference at code {} is {}", pdfCode, fetchedPDF); LOG.info("viewJob FileReference at code {} is {}", jobCode, fetchedPDF);
String theURL = null; String theURL = null;
String messagge = null; String messagge = null;
@ -300,7 +300,7 @@ public class GeoportalExporter {
return Response.status(Status.NOT_FOUND).entity(jsonReponse).build(); return Response.status(Status.NOT_FOUND).entity(jsonReponse).build();
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw ExceptionManager.internalErrorException(req, "Error when returning " throw ExceptionManager.internalErrorException(req, "Error when returning "
+ GeoportalExporter.class.getSimpleName() + " not found job for " + pdfCode, this.getClass(), + GeoportalExporter.class.getSimpleName() + " not found job for " + jobCode, this.getClass(),
helpURI); helpURI);
} }
@ -319,14 +319,14 @@ public class GeoportalExporter {
theJson.setState(state); theJson.setState(state);
} }
// updating map status // updating map status
map.put(pdfCode, fetchedPDF); map.put(jobCode, fetchedPDF);
} else { } else {
// File PDF is available // File PDF is available
state = "OK"; state = "OK";
theURL = fetchedPDF.getFileRef().getStorageVolatileURL().toString(); theURL = fetchedPDF.getFileRef().getStorageVolatileURL().toString();
messagge = "PDF created correclty"; messagge = "PDF created correclty";
// removing from map // removing from map
map.put(pdfCode, null); map.put(jobCode, null);
} }
theJson.setState(state); theJson.setState(state);
@ -338,14 +338,14 @@ public class GeoportalExporter {
return Response.ok(jsonReponse).build(); return Response.ok(jsonReponse).build();
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw ExceptionManager.internalErrorException(req, throw ExceptionManager.internalErrorException(req,
"Error when returning " + GeoportalExporter.class.getSimpleName() + " response for " + pdfCode, "Error when returning " + GeoportalExporter.class.getSimpleName() + " response for " + jobCode,
this.getClass(), helpURI); this.getClass(), helpURI);
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error on checking job", e); LOG.error("Error on checking job", e);
throw ExceptionManager.internalErrorException(req, throw ExceptionManager.internalErrorException(req,
"Error when checking " + GeoportalExporter.class.getSimpleName() + " job view for " + pdfCode, "Error when checking " + GeoportalExporter.class.getSimpleName() + " job view for " + jobCode,
this.getClass(), helpURI); this.getClass(), helpURI);
} }