Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadYearSelect.java @ 5694:8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 15 Apr 2013 10:55:08 +0200 |
parents | a30647abf009 |
children | fd020ac6f6cd |
comparison
equal
deleted
inserted
replaced
5693:28e3019a6b14 | 5694:8508ee487893 |
---|---|
1 package de.intevation.flys.artifacts.states.minfo; | 1 package de.intevation.flys.artifacts.states.minfo; |
2 | 2 |
3 import org.apache.log4j.Logger; | 3 import org.apache.log4j.Logger; |
4 | 4 |
5 import de.intevation.artifacts.Artifact; | |
6 | |
7 import de.intevation.flys.artifacts.FLYSArtifact; | |
8 | |
9 import de.intevation.flys.artifacts.access.SedimentLoadAccess; | |
5 import de.intevation.flys.artifacts.states.DefaultState; | 10 import de.intevation.flys.artifacts.states.DefaultState; |
6 | 11 |
7 | 12 |
8 public class SedimentLoadYearSelect | 13 public class SedimentLoadYearSelect |
9 extends DefaultState | 14 extends DefaultState |
21 @Override | 26 @Override |
22 protected String getUIProvider() { | 27 protected String getUIProvider() { |
23 return "minfo.sedimentload_year_select"; | 28 return "minfo.sedimentload_year_select"; |
24 } | 29 } |
25 | 30 |
31 | |
32 @Override | |
33 public boolean validate(Artifact artifact) | |
34 throws IllegalArgumentException | |
35 { | |
36 SedimentLoadAccess access = new SedimentLoadAccess((FLYSArtifact) artifact, null); | |
37 | |
38 // Second year should be later than first. | |
39 if (access.getPeriod()[1] < access.getPeriod()[0]) | |
40 throw new IllegalArgumentException("error_years_wrong"); | |
41 | |
42 return true; | |
43 } | |
26 } | 44 } |