[PATCH 2 of 3] issue1657: Spawn BEDHEIGHT_SOUNDING_WIDTH facet if asked to. Twiggly

Wald Commits scm-commit at wald.intevation.org
Thu Oct 31 11:44:06 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1383216212 -3600
# Node ID bc16d5031b3104725bcbd70f527b74cac2785329
# Parent  05c534215025e28880ca00c6a22bca089faf6b6b
issue1657: Spawn BEDHEIGHT_SOUNDING_WIDTH facet if asked to. Twiggly.

diff -r 05c534215025 -r bc16d5031b31 artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Thu Oct 31 11:41:39 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/BedHeightsArtifact.java	Thu Oct 31 11:43:32 2013 +0100
@@ -26,6 +26,8 @@
 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory;
 import org.dive4elements.river.artifacts.states.StaticState;
 
+import org.dive4elements.river.artifacts.resources.Resources;
+
 public class BedHeightsArtifact
 extends      AbstractStaticStateArtifact
 implements   FacetTypes
@@ -86,8 +88,20 @@
             String [] parts = code.split("-");
 
             if (parts.length >= 4) {
+                // The setting is a bit complicated:
+                // This artifact can spawn epoch type bedheight facets,
+                // 'singlevalue'/singleyear bedheight facets or
+                // sounding-width facets. The type is indicated by
+                // the ids-param which comes from datacage.
+
                 String name = parts[0];
                 String type = parts[1];
+                String facetType = BEDHEIGHT;
+                if (type.equals("soundings")) {
+                    type = "singlevalues";
+                    facetType = BEDHEIGHT_SOUNDING_WIDTH;
+                }
+                // e.g. 'single'
                 String btype = type;
                 int hId = Integer.parseInt(parts[2]);
                 if (name.equals("bedheight")) {
@@ -101,8 +115,16 @@
 
                 String bedHName = BedHeightFactory.getHeightName(btype, hId);
 
+                if (facetType.equals(BEDHEIGHT_SOUNDING_WIDTH)) {
+                    bedHName = Resources.getMsg(
+                        callMeta,
+                        "facet.bedheight.sounding_width",
+                        "facet.bedheight.sounding_widt",
+                        new Object[] { bedHName });
+                }
+
                 Facet facet = new BedHeightFacet(
-                        BEDHEIGHT, bedHName, type);
+                        facetType, bedHName, type);
 
                 ArrayList<Facet> facets = new ArrayList<Facet>(1);
                 facets.add(facet);
diff -r 05c534215025 -r bc16d5031b31 artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java	Thu Oct 31 11:41:39 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightSoundingProcessor.java	Thu Oct 31 11:43:32 2013 +0100
@@ -89,7 +89,7 @@
 
     @Override
     public boolean canHandle(String facettype) {
-        return FacetTypes.BEDHEIGHT.equals(facettype);
+        return FacetTypes.BEDHEIGHT_SOUNDING_WIDTH.equals(facettype);
     }
 
     @Override


More information about the Dive4elements-commits mailing list