changeset 929:960dc6328e70

Facets created by the WaterlevelState store information about state's id and artifact's hash value now. flys-artifacts/trunk@2286 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 06 Jul 2011 09:18:31 +0000
parents e7664917dbdf
children 3fd891d5228d
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java
diffstat 3 files changed, 29 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jul 05 17:28:57 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jul 06 09:18:31 2011 +0000
@@ -1,3 +1,15 @@
+2011-07-06  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java: A
+	  report facet can now store the state's id and the artifact's hash value
+	  when it has been created.
+
+	* src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java:
+	  Initialize the ReportFacet and WaterlevelFacet with state id and hash
+	  information. This has been necessary to retrieve reports and waterlevels
+	  in states after this one - in states that we need to enter for floodmap
+	  parameterization.
+
 2011-07-05  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/WaterlevelGroundDifferences.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java	Tue Jul 05 17:28:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java	Wed Jul 06 09:18:31 2011 +0000
@@ -19,6 +19,8 @@
     private static Logger logger = Logger.getLogger(ReportFacet.class);
 
     protected ComputeType type;
+    protected String      hash;
+    protected String      stateId;
 
     public ReportFacet() {
         this(ComputeType.ADVANCE);
@@ -29,13 +31,21 @@
         this.type = type;
     }
 
+
+    public ReportFacet(ComputeType type, String hash, String stateId) {
+        super(0, REPORT, "report");
+        this.type    = type;
+        this.hash    = hash;
+        this.stateId = stateId;
+    }
+
     public Object getData(Artifact artifact, CallContext context) {
         logger.debug("get report data");
 
         WINFOArtifact winfo = (WINFOArtifact)artifact;
 
         CalculationResult cr = (CalculationResult)winfo.compute(
-            context, type, false);
+            context, stateId, hash, type, false);
 
         return cr.getReport();
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Tue Jul 05 17:28:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Wed Jul 06 09:18:31 2011 +0000
@@ -86,8 +86,8 @@
             logger.debug("Create facet: " + nameW);
             logger.debug("Create facet: " + nameQ);
 
-            Facet w = new WaterlevelFacet(i, LONGITUDINAL_W, nameW);
-            Facet q = new WaterlevelFacet(i, LONGITUDINAL_Q, nameQ);
+            Facet w = new WaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, getID(), winfo.hash());
+            Facet q = new WaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, getID(), winfo.hash());
 
             facets.add(w);
             facets.add(q);
@@ -102,7 +102,10 @@
         }
 
         if (res.getReport().hasProblems()) {
-            facets.add(new ReportFacet());
+            facets.add(new ReportFacet(
+                ComputeType.ADVANCE,
+                winfo.hash(),
+                getID()));
         }
 
         return res;

http://dive4elements.wald.intevation.org