annotate 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
rev   line source
1045
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3 *
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 */
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
8 package de.intevation.lada.validation.rules.messprogramm;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
10 import de.intevation.lada.model.land.Messprogramm;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 import de.intevation.lada.validation.Violation;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
12 import de.intevation.lada.validation.annotation.ValidationRule;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
13 import de.intevation.lada.validation.rules.Rule;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 /**
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 * Validation rule for Messprogramm.
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 * Validates if the subintervall period is meaningful.
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 */
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19 @ValidationRule("Messprogramm")
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 public class SubIntervall implements Rule {
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22 @Override
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 public Violation execute(Object object) {
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 Messprogramm messprogramm = (Messprogramm)object;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25 Violation violation = new Violation();
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 if (messprogramm.getTeilintervallVon()
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28 > messprogramm.getTeilintervallBis()) {
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29 violation.addError("teilintervallVon", 662);
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30 violation.addError("teilintervallBis", 662);
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31 }
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33 return violation.hasErrors()
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 ? violation
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35 :null;
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36 }
61b94641cf99 A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
37 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)