diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java @ 3000:3dd1c320cf81

Changed data fields in fixings analysisperiods state. flys-artifacts/trunk@4556 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 30 May 2012 12:12:45 +0000
parents f53173a8736b
children 619fe13e2397
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java	Tue May 29 15:01:28 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java	Wed May 30 12:12:45 2012 +0000
@@ -299,22 +299,26 @@
     public long [][] getAnalysisPeriods() {
         if (analysisPeriods == null) {
             /** TODO: Use real arrays here! */
-            StateData sdStart = artifact.getData("ana_start");
-            StateData sdEnd   = artifact.getData("ana_end");
+            StateData sd = artifact.getData("ana_data");
 
-            if (sdStart == null || sdEnd == null) {
-                log.warn("missing 'ana_start' or 'ana_end'");
+            if (sd == null) {
+                log.warn("missing 'ana_data'");
                 return null;
             }
 
             try {
-                analysisPeriods = new long [][] {
-                    { Long.parseLong((String)sdStart.getValue()),
-                      Long.parseLong((String)sdEnd.getValue()) }
-                };
+                String data = (String)sd.getValue();
+                String[] pairs = data.split(";");
+                for (int i = 0; i < pairs.length; i++) {
+                    String[] fromTo = pairs[i].split(",");
+                    analysisPeriods = new long [][] {
+                        { Long.parseLong(fromTo[0]),
+                          Long.parseLong(fromTo[1]) }
+                    };
+                }
             }
             catch (NumberFormatException nfe) {
-                log.warn("'ana_start' or 'ana_end' is not an integer.");
+                log.warn("ana_data contains no long values.");
                 return null;
             }
         }

http://dive4elements.wald.intevation.org