annotate 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
rev   line source
1044
a796e68da1cf 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
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
3 *
a796e68da1cf 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)
a796e68da1cf 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
a796e68da1cf 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.
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
7 */
a796e68da1cf 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;
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
9
a796e68da1cf 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;
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
11 import de.intevation.lada.validation.Violation;
a796e68da1cf 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;
a796e68da1cf 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;
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
14
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
15 /**
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
16 * Validation rule for Messprogramm.
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
17 * Validates if the validity period is meaningful.
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
18 */
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
19 @ValidationRule("Messprogramm")
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
20 public class ValidFromTo implements Rule {
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
21
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
22 @Override
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
23 public Violation execute(Object object) {
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
24 Messprogramm messprogramm = (Messprogramm)object;
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
25 Violation violation = new Violation();
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
26
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
27 if (messprogramm.getGueltigVon() > messprogramm.getGueltigBis()) {
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
28 violation.addError("gueltigVon", 662);
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
29 violation.addError("gueltigBis", 662);
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
30 }
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
31
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
32 return violation.hasErrors()
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
33 ? violation
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
34 :null;
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
35 }
a796e68da1cf A period with end before start is not meaningful.
Tom Gottfried <tom@intevation.de>
parents:
diff changeset
36 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)