filter-on-projectname: acceptFilerName method added to accept filter on part of projectname
This commit is contained in:
parent
6a6110ab7a
commit
917110efec
1 changed files with 18 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.labels.entities.Label;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
|
|
@ -53,14 +54,17 @@ public class TaskGroupPredicate implements IPredicate {
|
|||
|
||||
private Date finishDate;
|
||||
|
||||
private String name;
|
||||
|
||||
private Boolean includeChildren;
|
||||
|
||||
public TaskGroupPredicate(List<FilterPair> filters, Date startDate,
|
||||
Date finishDate, Boolean includeChildren) {
|
||||
Date finishDate, Boolean includeChildren, String name) {
|
||||
this.filters = filters;
|
||||
this.startDate = startDate;
|
||||
this.finishDate = finishDate;
|
||||
this.includeChildren = includeChildren;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -73,7 +77,8 @@ public class TaskGroupPredicate implements IPredicate {
|
|||
if (taskGroup == null) {
|
||||
return false;
|
||||
}
|
||||
if (acceptFilters(taskGroup) && acceptFiltersDates(taskGroup)) {
|
||||
if (acceptFilters(taskGroup) && acceptFiltersDates(taskGroup)
|
||||
&& acceptFilterName(taskGroup)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -306,4 +311,15 @@ public class TaskGroupPredicate implements IPredicate {
|
|||
filters = listFilters;
|
||||
}
|
||||
|
||||
protected boolean acceptFilterName(TaskGroup taskGroup) {
|
||||
if (name == null) {
|
||||
return true;
|
||||
}
|
||||
if ((taskGroup.getName() != null)
|
||||
&& (StringUtils.containsIgnoreCase(taskGroup.getName(), name))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue