@Test public void testConvert() { final LocalDateTime changedFrom = LocalDateTime.now(); final LocalDateTime changedTo = LocalDateTime.now().plusDays(1); final String enhetId = "enhetId"; final String otherEnhetId = "otherId"; final String otherEnhetId2 = "otherId2"; final String hsaId = "hsaId"; final Integer pageSize = 5; final Boolean questionFromFK = Boolean.TRUE; final Boolean questionFromWC = Boolean.FALSE; final LocalDate replyLatest = LocalDate.now(); final Integer startFrom = 0; final String vantarPa = "SVAR_FRAN_FK"; final Boolean vidarebefordrad = Boolean.TRUE; QueryFragaSvarParameter source = createQueryFragaSvarParameter(changedFrom, changedTo, enhetId, hsaId, pageSize, questionFromFK, questionFromWC, replyLatest, startFrom, vantarPa, vidarebefordrad); List<String> unitIds = Arrays.asList(otherEnhetId, otherEnhetId2); Filter result = FilterConverter.convert(source, unitIds, Stream.of("fk7263").collect(Collectors.toSet())); assertEquals(changedFrom, result.getChangedFrom()); assertTrue(changedTo.isBefore(result.getChangedTo())); assertEquals(2, result.getEnhetsIds().size()); assertEquals(otherEnhetId, result.getEnhetsIds().get(0)); assertEquals(otherEnhetId2, result.getEnhetsIds().get(1)); assertEquals(hsaId, result.getHsaId()); assertEquals(pageSize, result.getPageSize()); assertTrue(result.isQuestionFromFK()); assertFalse(result.isQuestionFromWC()); assertEquals(replyLatest, result.getReplyLatest()); assertEquals(startFrom, result.getStartFrom()); assertEquals(VantarPa.SVAR_FRAN_FK, result.getVantarPa()); assertTrue(result.getVidarebefordrad()); }
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; }