// Only by dates and bandbox filter on global resources load
if (filterBy == null) {
LocalDate startDate = FilterUtils.readResourceLoadsStartDate();
LocalDate endDate = FilterUtils.readResourceLoadsEndDate();
User user = resourceLoadModel.getUser();
// Calculate filter based on user preferences
if (user != null) {
if (startDate == null
&& !FilterUtils.hasResourceLoadsStartDateChanged()) {
if (user.getResourcesLoadFilterPeriodSince() != null) {
startDate = new LocalDate().minusMonths(user
.getResourcesLoadFilterPeriodSince());
} else {
// Default filter start
startDate = new LocalDate().minusDays(1);
}
}
if ((endDate == null)
&& !FilterUtils.hasResourceLoadsEndDateChanged()
&& (user.getResourcesLoadFilterPeriodTo() != null)) {
endDate = new LocalDate().plusMonths(user
.getResourcesLoadFilterPeriodTo());
}
}
result.add(new ByDatesFilter(onChange, filterBy, startDate, endDate));
List<FilterPair> filterPairs = (List<FilterPair>) FilterUtils
.readResourceLoadsBandbox();
if ((filterPairs == null || filterPairs.isEmpty())
&& user.getResourcesLoadFilterCriterion() != null) {
filterPairs = new ArrayList<FilterPair>();
filterPairs.add(new FilterPair(
ResourceAllocationFilterEnum.Criterion, user
.getResourcesLoadFilterCriterion()
.getFinderPattern(), user
.getResourcesLoadFilterCriterion()));
}
WorkersOrCriteriaBandbox bandbox = new WorkersOrCriteriaBandbox(
onChange, filterBy, filterTypeChanger, resourcesSearcher, filterPairs);