Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java @ 3628:7467b091fb8e
Refactored location/distance state to use FLYSArtifact instead of WINFOArtifact.
flys-artifacts/trunk@5327 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Aug 2012 11:23:32 +0000 |
parents | c1f445b94d03 |
children | eb5564662e19 |
comparison
equal
deleted
inserted
replaced
3627:096598c3bd30 | 3628:7467b091fb8e |
---|---|
6 | 6 |
7 import de.intevation.artifacts.Artifact; | 7 import de.intevation.artifacts.Artifact; |
8 | 8 |
9 import de.intevation.artifactdatabase.data.StateData; | 9 import de.intevation.artifactdatabase.data.StateData; |
10 | 10 |
11 import de.intevation.flys.artifacts.FLYSArtifact; | |
11 import de.intevation.flys.artifacts.WINFOArtifact; | 12 import de.intevation.flys.artifacts.WINFOArtifact; |
12 | 13 |
13 | 14 |
14 /** | 15 /** |
15 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
46 public boolean validate(Artifact artifact) | 47 public boolean validate(Artifact artifact) |
47 throws IllegalArgumentException | 48 throws IllegalArgumentException |
48 { | 49 { |
49 logger.debug("LocationDistanceSelect.validate"); | 50 logger.debug("LocationDistanceSelect.validate"); |
50 | 51 |
51 WINFOArtifact flys = (WINFOArtifact) artifact; | 52 FLYSArtifact flys = (FLYSArtifact)artifact; |
52 | 53 StateData mode = getData(flys, MODE); |
53 if (flys.isRange()) { | 54 String mValue = mode != null ? (String)mode.getValue() : null; |
54 return super.validate(flys); | 55 if (mValue != null) { |
56 if (mValue.equals("distance")) { | |
57 return super.validate(flys); | |
58 } | |
59 else { | |
60 return validateLocations(flys); | |
61 } | |
55 } | 62 } |
56 else { | 63 return false; |
57 return validateLocations(flys); | |
58 } | |
59 } | 64 } |
60 | 65 |
61 | 66 |
62 protected boolean validateLocations(WINFOArtifact flys) | 67 protected boolean validateLocations(FLYSArtifact flys) |
63 throws IllegalArgumentException | 68 throws IllegalArgumentException |
64 { | 69 { |
65 StateData dValues = getData(flys, LOCATIONS); | 70 StateData dValues = getData(flys, LOCATIONS); |
66 String values = dValues != null ? (String)dValues.getValue() : null; | 71 String values = dValues != null ? (String)dValues.getValue() : null; |
67 | 72 |