use of se.inera.intyg.webcert.persistence.utkast.repository.UtkastFilter in project webcert by sklintyg.
the class UtkastApiController method filterDraftsForUnit.
/**
* Creates a filtered query to get drafts for a specific unit.
*/
@GET
@Path("/")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
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();
}
use of se.inera.intyg.webcert.persistence.utkast.repository.UtkastFilter in project webcert by sklintyg.
the class UtkastApiController method createUtkastFilter.
private UtkastFilter createUtkastFilter(QueryIntygParameter filterParameters) {
WebCertUser user = getWebCertUserService().getUser();
String selectedUnitHsaId = user.getValdVardenhet().getId();
UtkastFilter utkastFilter = new UtkastFilter(selectedUnitHsaId);
if (filterParameters != null) {
if (Boolean.FALSE.equals(filterParameters.getComplete())) {
utkastFilter.setStatusList(INCOMPLETE_DRAFTS);
} else if (Boolean.TRUE.equals(filterParameters.getComplete())) {
utkastFilter.setStatusList(COMPLETE_DRAFTS);
} else {
utkastFilter.setStatusList(ALL_DRAFTS);
}
utkastFilter.setSavedFrom(filterParameters.getSavedFrom());
utkastFilter.setSavedTo(filterParameters.getSavedTo());
utkastFilter.setSavedByHsaId(filterParameters.getSavedBy());
utkastFilter.setNotified(filterParameters.getNotified());
utkastFilter.setPageSize(filterParameters.getPageSize() == null ? DEFAULT_PAGE_SIZE : filterParameters.getPageSize());
utkastFilter.setStartFrom(filterParameters.getStartFrom() == null ? 0 : filterParameters.getStartFrom());
}
return utkastFilter;
}
Aggregations