@Test public void testGetIntygWithCoherentJournaling() { final String intygsTyp = "fk7263"; final String intygContent = "CONTENTS"; setupUser(AuthoritiesConstants.PRIVILEGE_VISA_INTYG, intygsTyp, true, true); IntygContentHolder content = mock(IntygContentHolder.class); when(content.getContents()).thenReturn(intygContent); when(intygService.fetchIntygDataWithRelations(eq(CERTIFICATE_ID), eq(intygsTyp), eq(true))).thenReturn(content); Response response = moduleApiController.getIntyg(intygsTyp, CERTIFICATE_ID); assertEquals(OK.getStatusCode(), response.getStatus()); assertEquals(intygContent, ((IntygContentHolder) response.getEntity()).getContents()); verify(intygService).fetchIntygDataWithRelations(eq(CERTIFICATE_ID), eq(intygsTyp), eq(true)); }
@GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) public Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId) { WebCertUser user = getWebCertUserService().getUser(); boolean coherentJournaling = user.getParameters() != null && user.getParameters().isSjf(); LOG.debug("Fetching signed intyg with id '{}' from IT, coherent journaling {}", intygsId, coherentJournaling); IntygContentHolder intygAsExternal = intygService.fetchIntygDataWithRelations(intygsId, intygsTyp, coherentJournaling); resourceLinkHelper.decorateIntygWithValidActionLinks(intygAsExternal); return Response.ok().entity(intygAsExternal).build(); }
IntygModuleApiController extends AbstractApiController { @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) public Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId) { WebCertUser user = getWebCertUserService().getUser(); boolean coherentJournaling = user.getParameters() != null && user.getParameters().isSjf(); LOG.debug("Fetching signed intyg with id '{}' from IT, coherent journaling {}", intygsId, coherentJournaling); IntygContentHolder intygAsExternal = intygService.fetchIntygDataWithRelations(intygsId, intygsTyp, coherentJournaling); resourceLinkHelper.decorateIntygWithValidActionLinks(intygAsExternal); return Response.ok().entity(intygAsExternal).build(); } }
IntygModuleApiController extends AbstractApiController { @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) public Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId) { WebCertUser user = getWebCertUserService().getUser(); boolean coherentJournaling = user.getParameters() != null && user.getParameters().isSjf(); LOG.debug("Fetching signed intyg with id '{}' from IT, coherent journaling {}", intygsId, coherentJournaling); IntygContentHolder intygAsExternal = intygService.fetchIntygDataWithRelations(intygsId, intygsTyp, coherentJournaling); resourceLinkHelper.decorateIntygWithValidActionLinks(intygAsExternal); return Response.ok().entity(intygAsExternal).build(); }  }
IntygModuleApiController extends AbstractApiController { @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) public Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId) { WebCertUser user = getWebCertUserService().getUser(); boolean coherentJournaling = user.getParameters() != null && user.getParameters().isSjf(); LOG.debug("Fetching signed intyg with id '{}' from IT, coherent journaling {}", intygsId, coherentJournaling); IntygContentHolder intygAsExternal = intygService.fetchIntygDataWithRelations(intygsId, intygsTyp, coherentJournaling); resourceLinkHelper.decorateIntygWithValidActionLinks(intygAsExternal); return Response.ok().entity(intygAsExternal).build(); }  @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId); @GET @Path("/{intygsTyp}/{intygsId}/pdf") @Produces("application/pdf") final Response getIntygAsPdf(@PathParam("intygsTyp") String intygsTyp, @PathParam(value = "intygsId") final String intygsId); @GET @Path("/{intygsTyp}/{intygsId}/pdf/arbetsgivarutskrift") @Produces("application/pdf") final Response getIntygAsPdfForEmployer(@PathParam("intygsTyp") String intygsTyp,
        @PathParam(value = "intygsId") final String intygsId); @POST @Path("/{intygsTyp}/{intygsId}/skicka") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response sendSignedIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        SendSignedIntygParameter param); @POST @Path("/{intygsTyp}/{intygsId}/aterkalla") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response revokeSignedIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        RevokeSignedIntygParameter param); @POST @Path("/{intygsTyp}/{intygsId}/komplettera") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createCompletion(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId); @POST @Path("/{intygsTyp}/{intygsId}/fornya") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createRenewal(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId); @POST @Path("/{intygsTyp}/{intygsId}/{newIntygsTyp}/create") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createUtkastFromSignedTemplate(CopyIntygRequest request, @PathParam("intygsTyp") String orgIntygsTyp,
        @PathParam("intygsId") String orgIntygsId, @PathParam("newIntygsTyp") String newIntygsTyp); @POST @Path("/{intygsTyp}/{intygsId}/ersatt") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createReplacement(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId); }
IntygModuleApiController extends AbstractApiController { @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) public Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId) { WebCertUser user = getWebCertUserService().getUser(); boolean coherentJournaling = user.getParameters() != null && user.getParameters().isSjf(); LOG.debug("Fetching signed intyg with id '{}' from IT, coherent journaling {}", intygsId, coherentJournaling); IntygContentHolder intygAsExternal = intygService.fetchIntygDataWithRelations(intygsId, intygsTyp, coherentJournaling); resourceLinkHelper.decorateIntygWithValidActionLinks(intygAsExternal); return Response.ok().entity(intygAsExternal).build(); }  @GET @Path("/{intygsTyp}/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response getIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId); @GET @Path("/{intygsTyp}/{intygsId}/pdf") @Produces("application/pdf") final Response getIntygAsPdf(@PathParam("intygsTyp") String intygsTyp, @PathParam(value = "intygsId") final String intygsId); @GET @Path("/{intygsTyp}/{intygsId}/pdf/arbetsgivarutskrift") @Produces("application/pdf") final Response getIntygAsPdfForEmployer(@PathParam("intygsTyp") String intygsTyp,
        @PathParam(value = "intygsId") final String intygsId); @POST @Path("/{intygsTyp}/{intygsId}/skicka") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response sendSignedIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        SendSignedIntygParameter param); @POST @Path("/{intygsTyp}/{intygsId}/aterkalla") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response revokeSignedIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        RevokeSignedIntygParameter param); @POST @Path("/{intygsTyp}/{intygsId}/komplettera") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createCompletion(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId); @POST @Path("/{intygsTyp}/{intygsId}/fornya") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createRenewal(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId); @POST @Path("/{intygsTyp}/{intygsId}/{newIntygsTyp}/create") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createUtkastFromSignedTemplate(CopyIntygRequest request, @PathParam("intygsTyp") String orgIntygsTyp,
        @PathParam("intygsId") String orgIntygsId, @PathParam("newIntygsTyp") String newIntygsTyp); @POST @Path("/{intygsTyp}/{intygsId}/ersatt") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) Response createReplacement(CopyIntygRequest request, @PathParam("intygsTyp") String intygsTyp,
        @PathParam("intygsId") String orgIntygsId);  }