Úprava agendy Budovy - oddělení chybových hlášení.
parent
7d4537f332
commit
a41f3143f2
@ -0,0 +1,56 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.Building;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class BuildingFilter implements Filter<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingFilter(Building condBuilding) {
|
||||
this.condBuilding = condBuilding;
|
||||
}
|
||||
|
||||
private static class BuildingMatcher extends TypeSafeMatcher<Building> {
|
||||
|
||||
private Building condBuilding;
|
||||
|
||||
public BuildingMatcher(Building cond) {
|
||||
this.condBuilding = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("buildings matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Building item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condBuilding.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condBuilding.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condBuilding.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Building> matchBuilding(Building building) {
|
||||
return new BuildingMatcher(building);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildingMatcher matcher() {
|
||||
return new BuildingMatcher(condBuilding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
BuildingsFormCodeConstr=Zadejte k\u00f3d budovy...
|
Loading…
Reference in New Issue