changeset 2010:7f99845e9499

Store and access area.name data item. flys-artifacts/trunk@3458 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Dec 2011 07:53:22 +0000
parents 0eab7d98a850
children 81eaea64c0db
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java
diffstat 4 files changed, 32 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Dec 16 14:59:31 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Dec 19 07:53:22 2011 +0000
@@ -1,3 +1,17 @@
+2011-12-19	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Added area.name data item and access to areaartifact.
+
+	* src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java:
+	  Rephrased debug output, do survive case where only one curve is
+	  given for area calculation (this is the "above" or "under" case).
+
+	* src/main/java/de/intevation/flys/artifacts/AreaArtifact.java
+	  (getAreaName): Access "area.name" data item.
+
+	* src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java:
+	  Respect area.name data of artifact when reproducing facets.
+
 2011-12-16	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/conf.xml: Fix, accidentally added wrong factory in last
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java	Fri Dec 16 14:59:31 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AreaArtifact.java	Mon Dec 19 07:53:22 2011 +0000
@@ -44,6 +44,9 @@
     /** data item name to access lower curve. */
     public static final String AREA_CURVE_UNDER = "area.curve_under";
 
+    /** Name of state. */
+    public static final String AREA_NAME = "area.name";
+
     /** Own logger. */
     private static final Logger logger =
         Logger.getLogger(AreaArtifact.class);
@@ -69,7 +72,7 @@
 
         super.setup(identifier, factory, context, callMeta, data);
 
-        // TODO ye unused.
+        // TODO yet unused.
         String ids = XMLUtils.xpathString(
             data, XPATH_IDS, ArtifactNamespaceContext.INSTANCE);
 
@@ -114,6 +117,12 @@
     }
 
 
+    /** Return data item that is used to configure name of area. */
+    public String getAreaName() {
+        return getDataAsString(AREA_NAME);
+    }
+
+
     /**
      * Create and return a new AreaCreationState with charting output.
      */
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Fri Dec 16 14:59:31 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Mon Dec 19 07:53:22 2011 +0000
@@ -40,7 +40,7 @@
      * @param context ignored
      */
     public Object getData(Artifact art, CallContext context) {
-        logger.debug("Get data for area ding");
+        logger.debug("Get data for area.");
 
         // Get information from artifact about which
         // info to grab from blackboard.
@@ -71,8 +71,7 @@
         }
 
         if (upperData == null && lowerData == null) {
-            logger.warn("No 'upper' given for area");
-            return null;
+            logger.warn("Not given 'upper' and 'lower' for area");
         }
 
         return new Object[] {lowerData, upperData};
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java	Fri Dec 16 14:59:31 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/AreaCreationState.java	Mon Dec 19 07:53:22 2011 +0000
@@ -11,7 +11,7 @@
 import de.intevation.artifactdatabase.state.Facet;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
-import de.intevation.flys.artifacts.WINFOArtifact;
+import de.intevation.flys.artifacts.AreaArtifact;
 import de.intevation.flys.artifacts.model.DataFacet;
 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.CalculationResult;
@@ -39,17 +39,19 @@
     }
 
 
+    /** Just reproduce the Facet. */
     protected Object compute(
-        FLYSArtifact winfo,
+        FLYSArtifact  areaArtifact,
         CallContext   cc,
         String        hash,
         List<Facet>   facets,
         Object        old
     ) {
         logger.debug("AreaCreationState.compute");
+
         if (facets != null) {
-            // TODO title
-            facets.add(new AreaFacet(0, "TODo now i am a different facet"));
+            facets.add(new AreaFacet(0,
+                ((AreaArtifact) areaArtifact).getAreaName()));
         }
 
         // TODO use compute to exploit caching strategies.

http://dive4elements.wald.intevation.org