Mercurial > lada > lada-server
changeset 127:ab094cd8d78b
New validator for LMessung.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 13 Jun 2013 09:28:16 +0200 |
parents | 410a3a25b3e9 |
children | 4b7784416090 |
files | src/main/java/de/intevation/lada/validation/LMessungValidator.java |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/validation/LMessungValidator.java Thu Jun 13 09:28:16 2013 +0200 @@ -0,0 +1,37 @@ +package de.intevation.lada.validation; + +import java.util.HashMap; +import java.util.Map; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; + +import de.intevation.lada.model.LMessung; + +/** + * Validator for LMessung objects. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ +@Named("lmessungvalidator") +@ApplicationScoped +public class LMessungValidator +implements Validator +{ + + @Override + public Map<String, Integer> validate(Object object) + throws ValidationException { + Map<String, Integer> warnings = new HashMap<String, Integer>(); + if (!(object instanceof LMessung)) { + Map<String, Integer> errors = new HashMap<String, Integer>(); + errors.put("lmessung", 610); + throw new ValidationException(errors); + } + LMessung messung = (LMessung)object; + + //TODO: mode validation, see LSB: VI - Konsistenzregeln. + return warnings; + } + +}