[Dive4elements-commits] [PATCH 4 of 4] [branch dc-km-filter] meta-data.xml: Use global vars and art. data for wst-km-filter

Wald Commits scm-commit at wald.intevation.org
Wed Jan 30 15:47:44 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1359557647 -3600
# Branch dc-km-filter
# Node ID c499201a30a3ee39c5aacbaf0b3ceba71db62b7b
# Parent  2cec81e697e8d992326339578aea36262e49c427
[branch dc-km-filter] meta-data.xml: Use global vars and art. data for wst-km-filter.

diff -r 2cec81e697e8 -r c499201a30a3 flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Jan 30 15:52:50 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Jan 30 15:54:07 2013 +0100
@@ -11,14 +11,37 @@
                  wst_ranges.b            AS defto
           FROM wst_columns, wst_ranges
           WHERE wst_columns.wst_id = ${prot_id} AND wst_ranges.wst_column_id = wst_columns.id
-          AND ( CAST(${startkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
-           OR CAST(${endkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
-           OR wst_ranges.a BETWEEN CAST(${startkm} AS DOUBLE PRECISION) AND CAST(${endkm} AS DOUBLE PRECISION)
+          AND ( CAST(${fromkm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR CAST(${tokm} AS DOUBLE PRECISION) BETWEEN wst_ranges.a AND wst_ranges.b
+           OR wst_ranges.a BETWEEN CAST(${fromkm} AS DOUBLE PRECISION) AND CAST(${tokm} AS DOUBLE PRECISION)
           )
           ORDER by wst_columns.position
       </dc:statement>
   </dc:macro>
   <dc:macro name="load-system">
+    <dc:variable name="fromkm" expr="dc:fromValue('', '', '')"/>
+    <dc:variable name="tokm" expr="dc:toValue('', '', '')"/>
+
+    <dc:if test="dc:contains($parameters, 'user-id')">
+     <dc:context connection="user">
+      <dc:statement>
+         SELECT COALESCE(ld_mode, '')      AS ldm,
+                COALESCE(ld_locations, '') AS ldl,
+                COALESCE(ld_from, '')      AS ldf,
+                COALESCE(ld_to, '')        AS ldt
+         FROM master_artifacts_range
+         WHERE gid = CAST(${artifact-id} as uuid)
+       </dc:statement>
+       <dc:elements>
+         <dc:variable name="fromkm" expr="dc:fromValue($ldm, $ldl, $ldf)"/>
+         <dc:variable name="tokm" expr="dc:toValue($ldm, $ldl, $ldt)"/>
+         <debug>
+                <dc:attribute name="name" value="[${artifact-id} , ${fromkm} : ${tokm}"/>
+         </debug>
+       </dc:elements>
+    </dc:context>
+    </dc:if>
+
     <dc:context connection="system">
       <dc:statement>
         SELECT id AS river_id, name as river_name FROM rivers


More information about the Dive4elements-commits mailing list