Mercurial > lada > lada-server
comparison src/main/java/de/intevation/lada/validation/rules/messprogramm/SubIntervall.java @ 1045:61b94641cf99
A period with end before start is not meaningful.
This is true for the subintervall, too.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 08 Sep 2016 12:03:43 +0200 |
parents | |
children | a7404bf577fd |
comparison
equal
deleted
inserted
replaced
1044:a796e68da1cf | 1045:61b94641cf99 |
---|---|
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 subintervall period is meaningful. | |
18 */ | |
19 @ValidationRule("Messprogramm") | |
20 public class SubIntervall 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.getTeilintervallVon() | |
28 > messprogramm.getTeilintervallBis()) { | |
29 violation.addError("teilintervallVon", 662); | |
30 violation.addError("teilintervallBis", 662); | |
31 } | |
32 | |
33 return violation.hasErrors() | |
34 ? violation | |
35 :null; | |
36 } | |
37 } |