Search in sources :

Example 1 with RFA1aFormsParameterObject

use of gov.ca.cwds.cals.web.rest.parameter.RFA1aFormsParameterObject in project cals-api by ca-cwds.

the class RFA1aPDFGenerationService method generatePDF.

public String generatePDF(Long formId) {
    String docId = null;
    RFA1aFormDTO rfa1aFormDTO = rfa1aFormService.find(new RFA1aFormsParameterObject(formId, true));
    if (rfa1aFormDTO != null) {
        docId = generatePDF(rfa1aFormDTO);
    }
    return docId;
}
Also used : RFA1aFormDTO(gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO) RFA1aFormsParameterObject(gov.ca.cwds.cals.web.rest.parameter.RFA1aFormsParameterObject)

Example 2 with RFA1aFormsParameterObject

use of gov.ca.cwds.cals.web.rest.parameter.RFA1aFormsParameterObject in project cals-api by ca-cwds.

the class RFA1aFormsResource method getApplicationForm.

// @UnitOfWork(CALSNS)
@GET
@Path("/{" + RFA_1A_APPLICATION_ID + "}")
@Produces({ MediaType.APPLICATION_JSON, APPLICATION_PDF })
@Timed
@ApiResponses(value = { @ApiResponse(code = 401, message = "Not Authorized"), @ApiResponse(code = 404, message = "Not found"), @ApiResponse(code = 406, message = "Accept Header not supported") })
@ApiOperation(value = "Returns RFA 1A Form by Id", response = RFA1aFormDTO.class)
public Response getApplicationForm(@PathParam(RFA_1A_APPLICATION_ID) @ApiParam(required = true, name = RFA_1A_APPLICATION_ID, value = "The RFA-1A Form Id") Long formId, @QueryParam(EXPANDED) @ApiParam(name = EXPANDED, value = "Use 'true' to get form with all parts of form included") boolean expanded, @Context HttpHeaders headers) {
    String accept = headers.getHeaderString(HttpHeaders.ACCEPT);
    long startTime = System.currentTimeMillis();
    Response response = null;
    if (APPLICATION_PDF.equals(accept)) {
        String documentId = pdfGenerationService.generatePDF(formId);
        response = pdfGenerationService.getFormPdf(documentId);
    } else {
        RFA1aFormsParameterObject params = new RFA1aFormsParameterObject(formId, expanded);
        response = resourceDelegate.get(params);
    }
    LOG.info("Get RFA1a form total time: {}", (System.currentTimeMillis() - startTime));
    return response;
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.annotations.ApiResponse) RFA1aFormsParameterObject(gov.ca.cwds.cals.web.rest.parameter.RFA1aFormsParameterObject) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

RFA1aFormsParameterObject (gov.ca.cwds.cals.web.rest.parameter.RFA1aFormsParameterObject)2 Timed (com.codahale.metrics.annotation.Timed)1 RFA1aFormDTO (gov.ca.cwds.cals.service.dto.rfa.RFA1aFormDTO)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponse (io.swagger.annotations.ApiResponse)1 ApiResponses (io.swagger.annotations.ApiResponses)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Response (javax.ws.rs.core.Response)1