changeset 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 096598c3bd30
children f3717e625b0a
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java
diffstat 2 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Aug 31 11:11:17 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Aug 31 11:23:32 2012 +0000
@@ -1,3 +1,8 @@
+2012-08-31  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java:
+	  Refactored state to use FLYSArtifact instead of WINFOArtifact.
+
 2012-08-31	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Fix issue817 (double datacage entries).
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java	Fri Aug 31 11:11:17 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java	Fri Aug 31 11:23:32 2012 +0000
@@ -8,6 +8,7 @@
 
 import de.intevation.artifactdatabase.data.StateData;
 
+import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 
 
@@ -48,18 +49,22 @@
     {
         logger.debug("LocationDistanceSelect.validate");
 
-        WINFOArtifact flys = (WINFOArtifact) artifact;
-
-        if (flys.isRange()) {
-            return super.validate(flys);
+        FLYSArtifact flys = (FLYSArtifact)artifact;
+        StateData mode = getData(flys, MODE);
+        String mValue = mode != null ? (String)mode.getValue() : null;
+        if (mValue != null) {
+            if (mValue.equals("distance")) {
+                return super.validate(flys);
+            }
+            else {
+                return validateLocations(flys);
+            }
         }
-        else {
-            return validateLocations(flys);
-        }
+        return false;
     }
 
 
-    protected boolean validateLocations(WINFOArtifact flys)
+    protected boolean validateLocations(FLYSArtifact flys)
     throws    IllegalArgumentException
     {
         StateData dValues = getData(flys, LOCATIONS);

http://dive4elements.wald.intevation.org