[PATCH] Let official epochs be showy and remove detritus of 'yields' in datacage config

Wald Commits scm-commit at wald.intevation.org
Mon Sep 8 15:54:16 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1410184452 -7200
# Node ID 1cd7225df846e9b46718dad0809fa21aa07235db
# Parent  a0994a326e2a6de941119697a005dc939b208bf7
Let official epochs be showy and remove detritus of 'yields' in datacage config.

diff -r a0994a326e2a -r 1cd7225df846 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon Sep 08 15:54:12 2014 +0200
@@ -1411,7 +1411,7 @@
             factory="sedimentload"
             target_out="{$out}"
             info="{$info}"
-            ids="{$syid};{$fraction};{$timespan}" />
+            ids="{$slid};{$fraction};{$timespan};{$kind}" />
     </dc:macro>
 
     <dc:macro name="load_ls">
@@ -1419,7 +1419,7 @@
             factory="sedimentload_ls"
             target_out="{$out}"
             info="{$info}"
-            ids="{$syid};{$timespan}" />
+            ids="{$slid};{$timespan};{$kind}" />
     </dc:macro>
 
     <dc:macro name="loads">
@@ -1439,6 +1439,10 @@
                                     '-', dc:date-format('yyyy', $endyear))"/>
                </dc:otherwise>
              </dc:choose>
+             <dc:if test="$kind = 'official'">
+               <dc:variable name="info" type="string"
+                            expr="concat('Amtliche Epoche<BR>', $info)"/>
+             </dc:if>
              <dc:macro-body/>
            </dc:for-each>
          </fraction>
@@ -1475,24 +1479,26 @@
           <dc:context>
             <dc:statement>
               SELECT DISTINCT
-                  sy.id          AS syid,
+                  sl.id          AS slid,
+                  slk.kind       AS kind,
                   ti.start_time  AS startyear,
                   ti.stop_time   AS endyear,
                   sq.start_time  AS sqstart,
                   sq.stop_time   AS sqstop,
                   gf.name        AS fraction,
-                  sy.description  || '<BR>' ||
+                  sl.description  || '<BR>' ||
                   'Fraktion: ' || gf.lower || ' bis ' || gf.upper ||
                   ' mm<BR>Einheit: t/a' AS info
-              FROM     sediment_load sy
-                  JOIN sediment_load_values syv
-                      ON sy.id = syv.sediment_load_id
+              FROM     sediment_load sl
+                  JOIN sediment_load_kinds slk ON slk.id = sl.kind
+                  JOIN sediment_load_values slv
+                      ON sl.id = slv.sediment_load_id
                   JOIN measurement_station ms
-                      ON ms.id = syv.measurement_station_id
+                      ON ms.id = slv.measurement_station_id
                   JOIN rivers r ON ms.river_id = r.id
-                  JOIN time_intervals ti ON sy.time_interval_id = ti.id
-                  LEFT JOIN time_intervals sq ON sy.sq_time_interval_id = sq.id
-                  JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
+                  JOIN time_intervals ti ON sl.time_interval_id = ti.id
+                  LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id
+                  JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id
               WHERE   r.id = ${river_id}
                   AND ms.station BETWEEN ${fromkm} AND ${tokm}
               ORDER BY sqstart DESC, sqstop DESC,
@@ -1509,25 +1515,27 @@
           <dc:context>
             <dc:statement>
               SELECT DISTINCT
-                  sy.id          AS syid,
+                  sl.id          AS slid,
+                  slk.kind       AS kind,
                   ti.start_time  AS startyear,
                   ti.stop_time   AS endyear,
                   sq.start_time  AS sqstart,
                   sq.stop_time   AS sqstop,
                   gf.name        AS fraction,
-                  sy.description  || '<BR>' ||
+                  sl.description  || '<BR>' ||
                   'Fraktion: ' || gf.lower || ' bis ' || gf.upper ||
                   ' mm<BR>Einheit: ' || u.name AS info
-              FROM     sediment_load_ls sy
-                  JOIN rivers r ON sy.river_id = r.id
-                  JOIN sediment_load_ls_values syv
-                      ON sy.id = syv.sediment_load_ls_id
-                  JOIN time_intervals ti ON sy.time_interval_id = ti.id
-                  LEFT JOIN time_intervals sq ON sy.sq_time_interval_id = sq.id
-                  JOIN grain_fraction gf ON gf.id = sy.grain_fraction_id
-                  JOIN units u ON sy.unit_id = u.id
+              FROM     sediment_load_ls sl
+                  JOIN sediment_load_kinds slk ON slk.id = sl.kind
+                  JOIN rivers r ON sl.river_id = r.id
+                  JOIN sediment_load_ls_values slv
+                      ON sl.id = slv.sediment_load_ls_id
+                  JOIN time_intervals ti ON sl.time_interval_id = ti.id
+                  LEFT JOIN time_intervals sq ON sl.sq_time_interval_id = sq.id
+                  JOIN grain_fraction gf ON gf.id = sl.grain_fraction_id
+                  JOIN units u ON sl.unit_id = u.id
               WHERE   r.id = ${river_id}
-                  AND syv.station BETWEEN ${fromkm} AND ${tokm}
+                  AND slv.station BETWEEN ${fromkm} AND ${tokm}
               ORDER BY sqstart DESC, sqstop DESC,
                   fraction, startyear DESC, endyear DESC
             </dc:statement>
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java	Mon Sep 08 15:54:12 2014 +0200
@@ -84,6 +84,7 @@
 
         String fraction = split.length >= 2 ? split[1] : "";
         String years    = split.length >= 3 ? split[2] : "";
+        String kind     = split.length >= 4 ? split[3] : "";
 
         // Name has the pattern sedimentload.ta.<grainfraction_name>
         name = NAME + "." + fraction;
@@ -94,6 +95,13 @@
                 "facet.sedimentload." + fraction,
                 new Object[] { years, "t/a" });
 
+        if (kind.equals("official")) {
+            String descPrefix = Resources.getMsg(
+                    callMeta,
+                    "facet.sedimentload.prefix.offcial");
+            description = descPrefix + description;
+        }
+
         ((D4EArtifact)artifact).addStringData("load_id", idStr);
     }
 
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadLSFacet.java	Mon Sep 08 15:54:12 2014 +0200
@@ -97,6 +97,7 @@
         String[] split = code.split(";");
         String idStr = split[0];
         String years = split.length >= 2 ? split[1] : "";
+        String kind  = split.length >= 3 ? split[2] : "";
 
         int id = Integer.valueOf(idStr);
         SedimentLoadLS theLoad = SedimentLoadLS.getSedimentLoadById(id);
@@ -138,8 +139,15 @@
         description = Resources.getMsg(
                 callMeta,
                 "facet.sedimentload." + gfName,
-                "Error: please add l10n for facet.sedimentload." + gfName,
                 new Object[] { years, i18nUnit });
+
+        if (kind.equals("official")) {
+            String descPrefix = Resources.getMsg(
+                    callMeta,
+                    "facet.sedimentload.prefix.offcial");
+            description = descPrefix + description;
+        }
+
         ((D4EArtifact)artifact).addStringData("load_id", idStr);
     }
 
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/java/org/dive4elements/river/artifacts/resources/Resources.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/resources/Resources.java	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/resources/Resources.java	Mon Sep 08 15:54:12 2014 +0200
@@ -80,6 +80,9 @@
         return meta.getPreferredLocale(locales);
     }
 
+    public static String getMsg(CallMeta meta, String key) {
+        return getMsg(meta, key, key);
+    }
 
     /**
      * This method returns the translated value for <i>key</i> or <i>def</i> if
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Mon Sep 08 15:54:12 2014 +0200
@@ -262,6 +262,7 @@
 chart.sedimentload.ls.xaxis.label = km
 chart.sedimentload.ls.yaxis.label.diff = [t/a]
 
+facet.sedimentload.prefix.offcial = Official epoch : 
 facet.sedimentload.coarse = Coarse gravel - {0} [{1}]
 facet.sedimentload.fine_middle = Fine/Mid. gravel - {0} [{1}]
 facet.sedimentload.sand = Sand - {0} [{1}]
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Sep 08 15:54:12 2014 +0200
@@ -263,6 +263,7 @@
 chart.sedimentload.ls.xaxis.label = km
 chart.sedimentload.ls.yaxis.label.diff = [t/a]
 
+facet.sedimentload.prefix.offcial = Amtliche Epoche: 
 facet.sedimentload.coarse = Grober Kies/Steine - {0} [{1}]
 facet.sedimentload.fine_middle = Fein/Mittlerer Kies - {0} [{1}]
 facet.sedimentload.sand = Sand - {0} [{1}]
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Mon Sep 08 15:54:12 2014 +0200
@@ -260,6 +260,7 @@
 chart.sedimentload.ls.xaxis.label = km
 chart.sedimentload.ls.yaxis.label.diff = [t/a]
 
+facet.sedimentload.prefix.offcial = Amtliche Epoche: 
 facet.sedimentload.coarse = Grober Kies/Steine - {0} [{1}]
 facet.sedimentload.fine_middle = Fein/Mittlerer Kies - {0} [{1}]
 facet.sedimentload.sand = Sand - {0} [{1}]
diff -r a0994a326e2a -r 1cd7225df846 artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Mon Sep 08 15:48:11 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Mon Sep 08 15:54:12 2014 +0200
@@ -264,6 +264,7 @@
 chart.sedimentload.ls.xaxis.label = km
 chart.sedimentload.ls.yaxis.label.diff = [t/a]
 
+facet.sedimentload.prefix.offcial = Official epoch : 
 facet.sedimentload.coarse = Coarse gravel - {0} [{1}]
 facet.sedimentload.fine_middle = Fine/Mid. gravel - {0} [{1}]
 facet.sedimentload.sand = Sand - {0} [{1}]


More information about the Dive4Elements-commits mailing list