diff artifacts/doc/conf/meta-data.xml @ 7236:a9bd4a23a852

(issue1474) Add datacage loading for SQ Relations
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 02 Oct 2013 17:04:23 +0200
parents ff7ab6b390a9
children 36fa4c752009
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Tue Oct 01 17:10:55 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Wed Oct 02 17:04:23 2013 +0200
@@ -296,6 +296,9 @@
                       <dc:call-macro name="basedata_5_flood-protections"/>
                     </dc:if>
                   </dc:when>
+                  <dc:when test="starts-with($out, 'sq_relation')">
+                    <dc:call-macro name="sqrelations"/>
+                  </dc:when>
                 </dc:choose>
               </dc:iterate>
             </dc:otherwise>
@@ -1618,6 +1621,40 @@
       </dc:context>
     </dc:macro>
 
+    <dc:macro name="sqrelations">
+      <dc:context>
+        <dc:statement>
+          SELECT sq.description  AS description,
+            ti.start_time        AS start_time,
+            ti.stop_time         AS stop_time,
+            ms.name              AS station_name,
+            lower(sqv.parameter) AS parameter,
+            sqv.id               AS sqvid
+          FROM sq_relation sq
+          JOIN time_intervals ti ON ti.id   = sq.time_interval_id
+          JOIN rivers r ON r.id = sq.river_id
+          JOIN sq_relation_value sqv ON sqv.sq_relation_id = sq.id
+          JOIN measurement_station ms ON sqv.measurement_station_id = ms.id
+          WHERE r.id = ${river_id}
+        </dc:statement>
+        <dc:if test="dc:has-result()">
+          <sq_relations>
+            <dc:filter expr="$out = concat('sq_relation_', $parameter)">
+              <dc:group expr="$station_name">
+                <station description="{dc:group-key()}">
+                  <dc:for-each>
+                    <dc:variable name="combined_desc" expr="concat(dc:date-format('yyyy', $start_time), ' bis ', dc:date-format('yyyy', $stop_time))"/>
+                    <sqvalue factory="staticsqrelation" target_out="{$out}"
+                      ids="{$sqvid};{$station_name}: {$combined_desc}" description="{$combined_desc}"/>
+                  </dc:for-each>
+                </station>
+              </dc:group>
+            </dc:filter>
+          </sq_relations>
+        </dc:if>
+      </dc:context>
+    </dc:macro>
+
     <dc:macro name="basedata_0_macro">
       <dc:filter expr="$kind = 0">
         <dc:if test="dc:has-result()">

http://dive4elements.wald.intevation.org