filter-on-projectname: acceptFilerName method added to accept filter on part of projectname
This commit is contained in:
parent
e5fdc5ea47
commit
6a6110ab7a
1 changed files with 19 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ package org.libreplan.web.orders;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||||
import org.libreplan.business.labels.entities.Label;
|
import org.libreplan.business.labels.entities.Label;
|
||||||
import org.libreplan.business.orders.entities.Order;
|
import org.libreplan.business.orders.entities.Order;
|
||||||
|
|
@ -51,13 +52,16 @@ public class OrderPredicate implements IPredicate {
|
||||||
|
|
||||||
private Date finishDate;
|
private Date finishDate;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
private Boolean includeOrderElements;
|
private Boolean includeOrderElements;
|
||||||
|
|
||||||
public OrderPredicate(List<FilterPair> filters, Date startDate,
|
public OrderPredicate(List<FilterPair> filters, Date startDate,
|
||||||
Date finishDate, Boolean includeOrderElements) {
|
Date finishDate, Boolean includeOrderElements, String name) {
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
this.finishDate = finishDate;
|
this.finishDate = finishDate;
|
||||||
|
this.name = name;
|
||||||
this.includeOrderElements = includeOrderElements;
|
this.includeOrderElements = includeOrderElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +75,8 @@ public class OrderPredicate implements IPredicate {
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (acceptFilters(order) && acceptFiltersDates(order)) {
|
if (acceptFilters(order) && acceptFiltersDates(order)
|
||||||
|
&& acceptFilterName(order)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -233,4 +238,16 @@ public class OrderPredicate implements IPredicate {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean acceptFilterName(Order order) {
|
||||||
|
if (name == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((order.getName() != null)
|
||||||
|
&& (StringUtils.containsIgnoreCase(order.getName(), name))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue