public void setSettings(DataPoolSettings settings) {
this.settings = settings;
}
public void load() {
addRules(new Rules(Person.class) {
@Override
protected void initRules() {
add("name", NAME_VALIDATION);
}
});
addRules(new Rules(Location.class) {
@Override
protected void initRules() {
add("capacity", all(new Constraint[]{gte(1), required()}));
add("name", NAME_VALIDATION);
}
});
addRules(new Rules(Event.class) {
@Override
protected void initRules() {
add("start", all(new Constraint[]{gte(0),
lt(settings.getTimeslotsPerWeek()), required()}));
add("name", NAME_VALIDATION);
}
});
addRules(new Rules(Feature.class) {
@Override
protected void initRules() {
add("name", NAME_VALIDATION);
}