changeset 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 703be13ffa74
children 619fe13e2397
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java
diffstat 3 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 29 15:01:28 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed May 30 12:12:45 2012 +0000
@@ -1,3 +1,12 @@
+2012-05-30  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml:
+	  Changed data fields to a single string data field. The data contains a
+	  string of semi-colon separated 'long' value pairs.
+
+	* src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java:
+	  Process the new data.
+
 2012-05-29	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/RelativePointFacet.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Tue May 29 15:01:28 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Wed May 30 12:12:45 2012 +0000
@@ -90,10 +90,7 @@
         <state id="state.fix.analysis.analysisperiods"
             description="state.fix.analysis.analysisperiods"
             state="de.intevation.flys.artifacts.states.fixation.AnalysisPeriods">
-            <!--Temporary data fields. These have to be changed to take n
-                periods-->
-            <data name="ana_start" type="Long"/>
-            <data name="ana_end" type="Long"/>
+            <data name="ana_data" type="String"/>
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- 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