changeset 1790:d3a0d55dff63

Add static data conf to w-difference / datacage. flys-artifacts/trunk@3113 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Oct 2011 12:41:10 +0000
parents 205eb6f124a5
children e0e5a5b51a40
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/meta-data.xml
diffstat 2 files changed, 82 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Oct 28 12:18:00 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Oct 28 12:41:10 2011 +0000
@@ -1,3 +1,12 @@
+2011-10-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Added DC-conf, such that static data can be loaded from w-difference
+	diagrams datacage.
+
+	* doc/conf/meta-data.xml: Minor "refactoring" (definition of two
+	  macros, allow certain static data to be loaded via datacage to
+	  w-difference diagrams, too.
+
 2011-10-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Load and display annotations in w-differences, minor polishing.
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Oct 28 12:18:00 2011 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Oct 28 12:41:10 2011 +0000
@@ -8,6 +8,75 @@
         WHERE lower(name) LIKE lower(${river})
       </dc:statement>
       <dc:elements>
+        <dc:comment>
+          Base-data macros (mostly data imported from wst-files)
+        </dc:comment>
+        <dc:macro name="basedata_0">
+            <dc:comment comment=" BASEDATA ---------------------------"/>
+            <basedata>
+              <dc:context>
+                <dc:statement>
+                  SELECT id          AS prot_id,
+                         description AS prot_description
+                  FROM wsts WHERE kind = 0 AND river_id = ${river_id}
+                </dc:statement>
+                <dc:elements>
+                  <basedata>
+                    <dc:attribute name="name" value="${prot_description}"/>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT id       AS prot_column_id,
+                               name     AS prot_column_name,
+                               position AS prot_rel_pos
+                        FROM wst_columns WHERE wst_id = ${prot_id}
+                        ORDER by position
+                      </dc:statement>
+                      <dc:elements>
+                        <column>
+                          <dc:attribute name="name" value="${prot_column_name}"/>
+                          <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
+                          <dc:attribute name="factory" value="staticwkms"/>
+                        </column>
+                      </dc:elements>
+                    </dc:context>
+                  </basedata>
+                </dc:elements>
+              </dc:context>
+            </basedata>
+        </dc:macro>
+        <dc:macro name="basedata_1_additionals">
+            <dc:comment comment=".ZUS -------------------------------"/>
+            <addtionals>
+              <dc:context>
+                <dc:statement>
+                  SELECT id          AS prot_id,
+                         description AS prot_description
+                  FROM wsts WHERE kind = 1 AND river_id = ${river_id}
+                </dc:statement>
+                <dc:elements>
+                  <additional>
+                    <dc:attribute name="name" value="${prot_description}"/>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT id       AS prot_column_id,
+                               name     AS prot_column_name,
+                               position AS prot_rel_pos
+                        FROM wst_columns WHERE wst_id = ${prot_id}
+                        ORDER by position
+                      </dc:statement>
+                      <dc:elements>
+                        <column>
+                          <dc:attribute name="name" value="${prot_column_name}"/>
+                          <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
+                          <dc:attribute name="factory" value="staticwkms"/>
+                        </column>
+                      </dc:elements>
+                    </dc:context>
+                  </additional>
+                </dc:elements>
+              </dc:context>
+            </addtionals>
+        </dc:macro>
         <river>
           <dc:attribute name="name" value="${river_name}"/>
           <dc:if test="dc:contains($artifact-outs, 'w_differences')">
@@ -16,73 +85,13 @@
               <dc:attribute name="ids"     value="${river_id}"/>
             </annotation>
           </dc:if>
-          <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
+          <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences'))">
             <dc:choose>
               <dc:when test="dc:contains($parameters, 'recommended')">
-                </dc:when>
+              </dc:when>
               <dc:otherwise>
-                <dc:comment comment=" BASEDATA ---------------------------"/>
-                <basedata>
-                  <dc:context>
-                    <dc:statement>
-                      SELECT id          AS prot_id,
-                             description AS prot_description
-                      FROM wsts WHERE kind = 0 AND river_id = ${river_id}
-                    </dc:statement>
-                    <dc:elements>
-                      <basedata>
-                        <dc:attribute name="name" value="${prot_description}"/>
-                        <dc:context>
-                          <dc:statement>
-                            SELECT id       AS prot_column_id,
-                                   name     AS prot_column_name,
-                                   position AS prot_rel_pos
-                            FROM wst_columns WHERE wst_id = ${prot_id}
-                            ORDER by position
-                          </dc:statement>
-                          <dc:elements>
-                            <column>
-                              <dc:attribute name="name" value="${prot_column_name}"/>
-                              <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/>
-                              <dc:attribute name="factory" value="staticwkms"/>
-                            </column>
-                          </dc:elements>
-                        </dc:context>
-                      </basedata>
-                    </dc:elements>
-                  </dc:context>
-                </basedata>
-                <dc:comment comment=".ZUS -------------------------------"/>
-                <addtionals>
-                  <dc:context>
-                    <dc:statement>
-                      SELECT id          AS prot_id,
-                             description AS prot_description
-                      FROM wsts WHERE kind = 1 AND river_id = ${river_id}
-                    </dc:statement>
-                    <dc:elements>
-                      <additional>
-                        <dc:attribute name="name" value="${prot_description}"/>
-                        <dc:context>
-                          <dc:statement>
-                            SELECT id       AS prot_column_id,
-                                   name     AS prot_column_name,
-                                   position AS prot_rel_pos
-                            FROM wst_columns WHERE wst_id = ${prot_id}
-                            ORDER by position
-                          </dc:statement>
-                          <dc:elements>
-                            <column>
-                              <dc:attribute name="name" value="${prot_column_name}"/>
-                              <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
-                              <dc:attribute name="factory" value="staticwkms"/>
-                            </column>
-                          </dc:elements>
-                        </dc:context>
-                      </additional>
-                    </dc:elements>
-                  </dc:context>
-                </addtionals>
+                <dc:call-macro name="basedata_0"/>
+                <dc:call-macro name="basedata_1_additionals"/>
                 <dc:comment comment=" FIXATIONS ---------------------------"/>
                 <fixations>
                   <dc:context>

http://dive4elements.wald.intevation.org