@Test public void testNoPageSizeNorStartFrom() { QueryFragaSvarParameter source = createQueryFragaSvarParameter(LocalDateTime.now(), LocalDateTime.now(), "enhetId", "hsaId", null, Boolean.FALSE, Boolean.TRUE, LocalDate.now(), null, "KOMPLETTERING_FRAN_VARDEN", Boolean.TRUE); Filter result = FilterConverter.convert(source, new ArrayList<>(), Stream.of("fk7263").collect(Collectors.toSet())); assertEquals(Integer.valueOf(0), result.getStartFrom()); assertEquals(FilterConverter.DEFAULT_PAGE_SIZE, result.getPageSize()); }
public static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper) { Filter filter = new Filter(); filter.getEnhetsIds().addAll(unitIds); if (!Strings.isNullOrEmpty(source.getVantarPa())) { filter.setVantarPa(VantarPa.valueOf(source.getVantarPa())); } filter.setChangedFrom(source.getChangedFrom()); if (source.getChangedTo() != null) { filter.setChangedTo(source.getChangedTo().plusDays(1)); } filter.setHsaId(source.getHsaId()); filter.setQuestionFromFK(getSafeBooleanValue(source.getQuestionFromFK())); filter.setQuestionFromWC(getSafeBooleanValue(source.getQuestionFromWC())); filter.setReplyLatest(source.getReplyLatest()); filter.setVidarebefordrad(source.getVidarebefordrad()); filter.setPageSize((source.getPageSize() == null) ? DEFAULT_PAGE_SIZE : source.getPageSize()); filter.setStartFrom((source.getStartFrom() == null) ? Integer.valueOf(0) : source.getStartFrom()); filter.setIntygsTyper(intygsTyper); if (source.getPatientPersonId() != null) { filter.setPatientPersonId(source.getPatientPersonId()); } return filter; }
FilterConverter { public static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper) { Filter filter = new Filter(); filter.getEnhetsIds().addAll(unitIds); if (!Strings.isNullOrEmpty(source.getVantarPa())) { filter.setVantarPa(VantarPa.valueOf(source.getVantarPa())); } filter.setChangedFrom(source.getChangedFrom()); if (source.getChangedTo() != null) { filter.setChangedTo(source.getChangedTo().plusDays(1)); } filter.setHsaId(source.getHsaId()); filter.setQuestionFromFK(getSafeBooleanValue(source.getQuestionFromFK())); filter.setQuestionFromWC(getSafeBooleanValue(source.getQuestionFromWC())); filter.setReplyLatest(source.getReplyLatest()); filter.setVidarebefordrad(source.getVidarebefordrad()); filter.setPageSize((source.getPageSize() == null) ? DEFAULT_PAGE_SIZE : source.getPageSize()); filter.setStartFrom((source.getStartFrom() == null) ? Integer.valueOf(0) : source.getStartFrom()); filter.setIntygsTyper(intygsTyper); if (source.getPatientPersonId() != null) { filter.setPatientPersonId(source.getPatientPersonId()); } return filter; } }
FilterConverter { public static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper) { Filter filter = new Filter(); filter.getEnhetsIds().addAll(unitIds); if (!Strings.isNullOrEmpty(source.getVantarPa())) { filter.setVantarPa(VantarPa.valueOf(source.getVantarPa())); } filter.setChangedFrom(source.getChangedFrom()); if (source.getChangedTo() != null) { filter.setChangedTo(source.getChangedTo().plusDays(1)); } filter.setHsaId(source.getHsaId()); filter.setQuestionFromFK(getSafeBooleanValue(source.getQuestionFromFK())); filter.setQuestionFromWC(getSafeBooleanValue(source.getQuestionFromWC())); filter.setReplyLatest(source.getReplyLatest()); filter.setVidarebefordrad(source.getVidarebefordrad()); filter.setPageSize((source.getPageSize() == null) ? DEFAULT_PAGE_SIZE : source.getPageSize()); filter.setStartFrom((source.getStartFrom() == null) ? Integer.valueOf(0) : source.getStartFrom()); filter.setIntygsTyper(intygsTyper); if (source.getPatientPersonId() != null) { filter.setPatientPersonId(source.getPatientPersonId()); } return filter; } private  FilterConverter(); }
FilterConverter { public static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper) { Filter filter = new Filter(); filter.getEnhetsIds().addAll(unitIds); if (!Strings.isNullOrEmpty(source.getVantarPa())) { filter.setVantarPa(VantarPa.valueOf(source.getVantarPa())); } filter.setChangedFrom(source.getChangedFrom()); if (source.getChangedTo() != null) { filter.setChangedTo(source.getChangedTo().plusDays(1)); } filter.setHsaId(source.getHsaId()); filter.setQuestionFromFK(getSafeBooleanValue(source.getQuestionFromFK())); filter.setQuestionFromWC(getSafeBooleanValue(source.getQuestionFromWC())); filter.setReplyLatest(source.getReplyLatest()); filter.setVidarebefordrad(source.getVidarebefordrad()); filter.setPageSize((source.getPageSize() == null) ? DEFAULT_PAGE_SIZE : source.getPageSize()); filter.setStartFrom((source.getStartFrom() == null) ? Integer.valueOf(0) : source.getStartFrom()); filter.setIntygsTyper(intygsTyper); if (source.getPatientPersonId() != null) { filter.setPatientPersonId(source.getPatientPersonId()); } return filter; } private  FilterConverter(); static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper); }
FilterConverter { public static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper) { Filter filter = new Filter(); filter.getEnhetsIds().addAll(unitIds); if (!Strings.isNullOrEmpty(source.getVantarPa())) { filter.setVantarPa(VantarPa.valueOf(source.getVantarPa())); } filter.setChangedFrom(source.getChangedFrom()); if (source.getChangedTo() != null) { filter.setChangedTo(source.getChangedTo().plusDays(1)); } filter.setHsaId(source.getHsaId()); filter.setQuestionFromFK(getSafeBooleanValue(source.getQuestionFromFK())); filter.setQuestionFromWC(getSafeBooleanValue(source.getQuestionFromWC())); filter.setReplyLatest(source.getReplyLatest()); filter.setVidarebefordrad(source.getVidarebefordrad()); filter.setPageSize((source.getPageSize() == null) ? DEFAULT_PAGE_SIZE : source.getPageSize()); filter.setStartFrom((source.getStartFrom() == null) ? Integer.valueOf(0) : source.getStartFrom()); filter.setIntygsTyper(intygsTyper); if (source.getPatientPersonId() != null) { filter.setPatientPersonId(source.getPatientPersonId()); } return filter; } private  FilterConverter(); static Filter convert(QueryFragaSvarParameter source, List<String> unitIds, Set<String> intygsTyper); static final Integer DEFAULT_PAGE_SIZE; }