@Test public void testFilterDraftsForUnitSortingByPersonnummerIsCorrectINTYGFV12187() { setupUser(AuthoritiesConstants.PRIVILEGE_HANTERA_SEKRETESSMARKERAD_PATIENT, LuseEntryPoint.MODULE_ID, AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST); final Utkast utkast1 = buildUtkast(createPnr("19121211-1212")); final Utkast utkast2 = buildUtkast(createPnr("19121212-1212")); final Utkast utkast3 = buildUtkast(createPnr("19121213-1212")); when(utkastService.filterIntyg(any())).thenReturn(Arrays.asList(utkast1, utkast3, utkast2)); final QueryIntygParameter filterParameters = buildQueryIntygParameter(); filterParameters.setOrderAscending(false); filterParameters.setOrderBy("patientPersonnummer"); final Response response = utkastController.filterDraftsForUnit(filterParameters); final QueryIntygResponse queryIntygResponse = response.readEntity(QueryIntygResponse.class); assertEquals(3, queryIntygResponse.getResults().size()); assertEquals(utkast3.getPatientPersonnummer().getPersonnummer(), queryIntygResponse.getResults().get(0).getPatientId().getPersonnummer()); assertEquals(utkast2.getPatientPersonnummer().getPersonnummer(), queryIntygResponse.getResults().get(1).getPatientId().getPersonnummer()); assertEquals(utkast1.getPatientPersonnummer().getPersonnummer(), queryIntygResponse.getResults().get(2).getPatientId().getPersonnummer()); }
@GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters) { authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow(); UtkastFilter utkastFilter = createUtkastFilter(filterParameters); QueryIntygResponse queryResponse = performUtkastFilterQuery(utkastFilter); return Response.ok(queryResponse).build(); }
UtkastApiController extends AbstractApiController { @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters) { authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow(); UtkastFilter utkastFilter = createUtkastFilter(filterParameters); QueryIntygResponse queryResponse = performUtkastFilterQuery(utkastFilter); return Response.ok(queryResponse).build(); } }
UtkastApiController extends AbstractApiController { @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters) { authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow(); UtkastFilter utkastFilter = createUtkastFilter(filterParameters); QueryIntygResponse queryResponse = performUtkastFilterQuery(utkastFilter); return Response.ok(queryResponse).build(); }  }
UtkastApiController extends AbstractApiController { @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters) { authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow(); UtkastFilter utkastFilter = createUtkastFilter(filterParameters); QueryIntygResponse queryResponse = performUtkastFilterQuery(utkastFilter); return Response.ok(queryResponse).build(); }  @POST @Path("/{intygsTyp}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response createUtkast(@PathParam("intygsTyp") String intygsTyp, CreateUtkastRequest request); @GET @Path("/questions/{intygsTyp}/{version}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getQuestions(@PathParam("intygsTyp") String intygsTyp, @PathParam("version") String version); @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters); @GET @Path("/lakare") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getLakareWithDraftsByEnheter(); @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer,
                                                   @PathParam("currentDraftId") String currentDraftId); }
UtkastApiController extends AbstractApiController { @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters) { authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow(); UtkastFilter utkastFilter = createUtkastFilter(filterParameters); QueryIntygResponse queryResponse = performUtkastFilterQuery(utkastFilter); return Response.ok(queryResponse).build(); }  @POST @Path("/{intygsTyp}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response createUtkast(@PathParam("intygsTyp") String intygsTyp, CreateUtkastRequest request); @GET @Path("/questions/{intygsTyp}/{version}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getQuestions(@PathParam("intygsTyp") String intygsTyp, @PathParam("version") String version); @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters); @GET @Path("/lakare") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getLakareWithDraftsByEnheter(); @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer,
                                                   @PathParam("currentDraftId") String currentDraftId);  }