Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/validation/rules/messprogramm/ValidFromTo.java @ 1044:a796e68da1cf
A period with end before start is not meaningful.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 07 Sep 2016 18:17:48 +0200 |
parents | |
children | a7404bf577fd |
comparison
equal
deleted
inserted
replaced
1019:e192feaf916f | 1044:a796e68da1cf |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 package de.intevation.lada.validation.rules.messprogramm; | |
9 | |
10 import de.intevation.lada.model.land.Messprogramm; | |
11 import de.intevation.lada.validation.Violation; | |
12 import de.intevation.lada.validation.annotation.ValidationRule; | |
13 import de.intevation.lada.validation.rules.Rule; | |
14 | |
15 /** | |
16 * Validation rule for Messprogramm. | |
17 * Validates if the validity period is meaningful. | |
18 */ | |
19 @ValidationRule("Messprogramm") | |
20 public class ValidFromTo implements Rule { | |
21 | |
22 @Override | |
23 public Violation execute(Object object) { | |
24 Messprogramm messprogramm = (Messprogramm)object; | |
25 Violation violation = new Violation(); | |
26 | |
27 if (messprogramm.getGueltigVon() > messprogramm.getGueltigBis()) { | |
28 violation.addError("gueltigVon", 662); | |
29 violation.addError("gueltigBis", 662); | |
30 } | |
31 | |
32 return violation.hasErrors() | |
33 ? violation | |
34 :null; | |
35 } | |
36 } |