Úprava agendy Budovy - oddělení chybových hlášení.

multitenant
František Přibyl 11 years ago
parent 7d4537f332
commit a41f3143f2

@ -3,38 +3,33 @@ package info.bukova.isspst.data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
@Entity @Entity
@Table(name="BUILDING") @Table(name = "BUILDING")
public class Building extends BaseData implements DataModel { public class Building extends BaseData implements DataModel {
@Column(name = "CODE", unique = true)
@Column(name="CODE", unique=true)
private String code; private String code;
@Column(name="NAME") @Column(name = "NAME")
private String name; private String name;
@Column(name="DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
/** /**
* @return the code * @return the code
*/ */
@NotBlank(message = "${labels.BuildingsFormCodeConstr}") @NotBlank(message = "{BuildingsFormCodeConstr}")
@NotNull(message = "${labels.BuildingsFormCodeConstr}")
@NotEmpty(message = "${labels.BuildingsFormCodeConstr}")
public String getCode() { public String getCode() {
return code; return code;
} }
/** /**
* @param code the code to set * @param code
* the code to set
*/ */
public void setCode(String code) { public void setCode(String code) {
this.code = code; this.code = code;
@ -48,7 +43,8 @@ public class Building extends BaseData implements DataModel {
} }
/** /**
* @param name the name to set * @param name
* the name to set
*/ */
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
@ -62,7 +58,8 @@ public class Building extends BaseData implements DataModel {
} }
/** /**
* @param description the description to set * @param description
* the description to set
*/ */
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;

@ -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...

@ -2,7 +2,6 @@
AgendaBuildings=Budovy AgendaBuildings=Budovy
BuildingsFormCode=Kód BuildingsFormCode=Kód
BuildingsFormCodeConstr=Zadejte kód budovy...
BuildingsFormName=Název BuildingsFormName=Název
BuildingsFormDescription=Popis BuildingsFormDescription=Popis

Loading…
Cancel
Save