use of org.apache.commons.collections15.ListUtils in project dhis2-core by dhis2.
the class MonitoringJob method getPeriods.
private List<Period> getPeriods(MonitoringJobParameters params, Collection<ValidationRule> rules) {
if (params.getRelativeStart() != 0 && params.getRelativeEnd() != 0) {
Date startDate = getDateAfterAddition(new Date(), params.getRelativeStart());
Date endDate = getDateAfterAddition(new Date(), params.getRelativeEnd());
List<Period> periods = periodService.getPeriodsBetweenDates(startDate, endDate);
return ListUtils.union(periods, periodService.getIntersectionPeriods(periods));
}
return rules.stream().map(ValidationRule::getPeriodType).distinct().map(vr -> asList(vr.createPeriod(), vr.getPreviousPeriod(vr.createPeriod()))).reduce(Lists.newArrayList(), ListUtils::union);
}
Aggregations