changeset 1181:dd59431d648f

Repaired datacage configuration. The system specific stuff is also displayed if a user-id is given. flys-artifacts/trunk@2772 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 16 Sep 2011 09:51:02 +0000
parents 1aba1a75beb2
children 8ad0331e444f
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/meta-data.xml
diffstat 2 files changed, 289 insertions(+), 273 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 16 08:47:09 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 16 09:51:02 2011 +0000
@@ -1,3 +1,10 @@
+2011-09-16  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/meta-data.xml: Moved the system specific configuration into a
+	  macro to the top of the configuration document. Call this macro at the
+	  end of the user specific part and in the part that should contain the
+	  system specific stuff only!
+
 2011-09-16  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Sep 16 08:47:09 2011 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Sep 16 09:51:02 2011 +0000
@@ -1,6 +1,280 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
 <datacage>
+  <dc:macro name="load-system">
+    <dc:context connection="system">
+      <dc:statement>
+        SELECT id AS river_id, name as river_name FROM rivers
+        WHERE lower(name) LIKE lower(${river})
+      </dc:statement>
+      <dc:elements>
+        <river>
+          <dc:attribute name="name" value="${river_name}"/>
+          <dc:attribute name="db-id" value="${river_id}"/>
+          <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
+              <discharge-table-nn>
+                <discharge-table-gauge>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id   AS gauge_id,
+                             name AS gauge_name
+                      FROM gauges WHERE river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <gauge>
+                        <dc:attribute name="name" value="${gauge_name}"/>
+                        <dc:attribute name="db-id" value="${gauge_id}"/>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT description   AS gauge_desc, 
+                                   d.id          AS discharge_id,
+                                   ti.start_time AS g_start, 
+                                   ti.stop_time  AS g_stop
+                            FROM discharge_tables d JOIN time_intervals ti 
+                            ON d.time_interval_id = ti.id
+                            WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
+                          </dc:statement>
+                          <dc:elements>
+                            <historical>
+                              <dc:attribute name="name" value="${gauge_desc}"/>
+                              <dc:attribute name="from" value="${g_start}"/>
+                              <dc:attribute name="to" value="${g_stop}"/>
+                              <dc:attribute name="db-id" value="${discharge_id}"/></historical>
+                          </dc:elements>
+                        </dc:context>
+                      </gauge>
+                    </dc:elements>
+                  </dc:context>
+                </discharge-table-gauge>
+                <fixations>
+                  <dc:attribute name="id" value="fixations-${river_id}"/>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id          AS fix_id,
+                             description AS fix_description
+                      FROM wsts WHERE kind = 2 AND river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <fixation>
+                        <dc:attribute name="name" value="${fix_description}"/>
+                        <dc:attribute name="db-id" value="${fix_id}"/>
+                        <columns>
+                          <dc:context>
+                            <dc:statement>
+                              SELECT id   AS fix_column_id,
+                                     name AS fix_column_name
+                              FROM wst_columns WHERE wst_id = ${fix_id}
+                              ORDER by position
+                            </dc:statement>
+                            <dc:elements>
+                              <column>
+                                <dc:attribute name="name" value="${fix_column_name}"/>
+                                <dc:attribute name="db-id" value="${fix_column_id}"/></column>
+                            </dc:elements>
+                          </dc:context>
+                        </columns>
+                      </fixation>
+                    </dc:elements>
+                  </dc:context>
+                </fixations>
+                <flood-protections>
+                  <dc:attribute name="id" value="flood-protections-${river_id}"/>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id          AS prot_id,
+                             description AS prot_description
+                      FROM wsts WHERE kind = 5 AND river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <flood-protection>
+                        <dc:attribute name="name" value="${prot_description}"/>
+                        <dc:attribute name="db-id" value="${prot_id}"/>
+                        <columns>
+                          <dc:context>
+                            <dc:statement>
+                              SELECT id   AS prot_column_id,
+                                     name AS prot_column_name
+                              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="db-id" value="${prot_column_id}"/></column>
+                            </dc:elements>
+                          </dc:context>
+                        </columns>
+                      </flood-protection>
+                    </dc:elements>
+                  </dc:context>
+                </flood-protections>
+                <flood-water-marks>
+                  <dc:attribute name="id" value="flood-water-marks-${river_id}"/>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id          AS fw_id,
+                             description AS fw_description
+                      FROM wsts WHERE kind = 4 AND river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <flood-water-mark>
+                        <dc:attribute name="name" value="${fw_description}"/>
+                        <dc:attribute name="db-id" value="${fw_id}"/>
+                        <columns>
+                          <dc:context>
+                            <dc:statement>
+                              SELECT id   AS fw_column_id,
+                                     name AS fw_column_name
+                              FROM wst_columns WHERE wst_id = ${fw_id}
+                              ORDER by position
+                            </dc:statement>
+                            <dc:elements>
+                              <column>
+                                <dc:attribute name="name" value="${fw_column_name}"/>
+                                <dc:attribute name="db-id" value="${fw_column_id}"/></column>
+                            </dc:elements>
+                          </dc:context>
+                        </columns>
+                      </flood-water-mark>
+                    </dc:elements>
+                  </dc:context>
+                </flood-water-marks>
+                <water-levels>
+                  <dc:attribute name="id" value="water-levels-${river_id}"/>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id          AS wl_id,
+                             description AS wl_description
+                      FROM wsts WHERE kind = 0 AND river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <water-level>
+                        <dc:attribute name="name" value="${wl_description}"/>
+                        <dc:attribute name="db-id" value="${wl_id}"/>
+                        <columns>
+                          <dc:context>
+                            <dc:statement>
+                              SELECT id   AS wl_column_id,
+                                     name AS wl_column_name
+                              FROM wst_columns WHERE wst_id = ${wl_id}
+                              ORDER by position
+                            </dc:statement>
+                            <dc:elements>
+                              <column>
+                                <dc:attribute name="name" value="${wl_column_name}"/>
+                                <dc:attribute name="db-id" value="${wl_column_id}"/></column>
+                            </dc:elements>
+                          </dc:context>
+                        </columns>
+                      </water-level>
+                    </dc:elements>
+                  </dc:context>
+                </water-levels>
+                <extra-longitudinal-sections>
+                  <dc:attribute name="id" value="extra-longitudinal-sections-${river_id}"/>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT id          AS els_id,
+                             description AS els_description
+                      FROM wsts WHERE kind = 1 AND river_id = ${river_id}
+                    </dc:statement>
+                    <dc:elements>
+                      <extra-longitudinal-section>
+                        <dc:attribute name="name" value="${els_description}"/>
+                        <dc:attribute name="db-id" value="${els_id}"/>
+                        <columns>
+                          <dc:context>
+                            <dc:statement>
+                              SELECT id   AS els_column_id,
+                                     name AS els_column_name
+                              FROM wst_columns WHERE wst_id = ${els_id}
+                              ORDER by position
+                            </dc:statement>
+                            <dc:elements>
+                              <column>
+                                  <dc:attribute name="name" value="${els_column_name}"/>
+                                  <dc:attribute name="db-id" value="${els_column_id}"/></column>
+                            </dc:elements>
+                          </dc:context>
+                        </columns>
+                      </extra-longitudinal-section>
+                    </dc:elements>
+                  </dc:context>
+                </extra-longitudinal-sections>
+              </discharge-table-nn>
+          </dc:if>
+          <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
+              <computed-discharge-curve>
+                <mainvalue>
+                  <dc:attribute name="factory" value="mainvalue"/>
+                  <dc:attribute name="db-ids" value="${river_id}"/>
+                </mainvalue>
+              </computed-discharge-curve>
+          </dc:if>
+          <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
+              <longitudinal-section>
+                <dc:call-macro name="longitudinal_section-recommended"/>
+                <fixations><dc:attribute name="ref" value="fixations-${river_id}"/></fixations>
+                <flood-protections><dc:attribute name="ref" value="flood-protections-${river_id}"/></flood-protections>
+                <flood-water-marks><dc:attribute name="ref" value="flood-water-marks-${river_id}"/></flood-water-marks>
+                <water-levels><dc:attribute name="ref" value="water-levels-${river_id}"/></water-levels>
+                <extra-longitudinal-sections><dc:attribute name="ref" value="extra-longitudinal-sections-${river_id}"/></extra-longitudinal-sections>
+              </longitudinal-section>
+              <dc:macro name="longitudinal_section-recommended">
+                <annotation>
+                          <dc:attribute name="factory" value="annotations"/>
+                          <dc:attribute name="ids" value="${river_id}"/>
+                </annotation>
+              </dc:macro>
+          </dc:if>
+          <dc:if test="dc:contains($artifact-outs, 'floodmap')">
+              <floodmap>
+              <dc:choose>
+                  <dc:when test="dc:contains($parameters, 'recommended')">
+                    <dc:call-macro name="flood-map-recommended"/>
+                  </dc:when>
+                  <dc:otherwise>
+                    <dc:call-macro name="flood-map-complete"/>
+                  </dc:otherwise>
+              </dc:choose>
+              </floodmap>
+              <dc:macro name="flood-map-recommended">
+                <dc:comment>
+                   FIXME: Following two macros look identical to me.
+                </dc:comment>
+                  <kilometrage>
+                      <riveraxis>
+                          <dc:attribute name="factory" value="riveraxis"/>
+                          <dc:attribute name="ids" value="${river_id}"/>
+                      </riveraxis>
+                  </kilometrage>
+                  <rastermap>
+                      <background>
+                          <dc:attribute name="factory" value="wmsbackground"/>
+                          <dc:attribute name="ids" value="${river_id}"/>
+                      </background>
+                  </rastermap>
+              </dc:macro>
+              <dc:macro name="flood-map-complete">
+                  <kilometrage>
+                      <riveraxis>
+                          <dc:attribute name="factory" value="riveraxis"/>
+                          <dc:attribute name="ids" value="${river_id}"/>
+                      </riveraxis>
+                  </kilometrage>
+                  <rastermap>
+                      <background>
+                          <dc:attribute name="factory" value="wmsbackground"/>
+                          <dc:attribute name="ids" value="${river_id}"/>
+                      </background>
+                  </rastermap>
+              </dc:macro>
+          </dc:if>
+        </river>
+      </dc:elements>
+    </dc:context>
+  </dc:macro>
+
   <dc:choose>
     <dc:comment>
       User specific part
@@ -55,283 +329,18 @@
           </dc:elements>
         </dc:context>
       </old_calculations>
+      <dc:comment>
+        System specific part
+        --------------------
+      </dc:comment>
+      <dc:call-macro name="load-system"/>
     </dc:when>
     <dc:comment>
-      System specific part
-      --------------------
+      System specific part only
+      -------------------------
     </dc:comment>
     <dc:otherwise>
-      <dc:context connection="system">
-        <dc:statement>
-          SELECT id AS river_id, name as river_name FROM rivers
-          WHERE lower(name) LIKE lower(${river})
-        </dc:statement>
-        <dc:elements>
-          <river>
-            <dc:attribute name="name" value="${river_name}"/>
-            <dc:attribute name="db-id" value="${river_id}"/>
-            <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
-                <discharge-table-nn>
-                  <discharge-table-gauge>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id   AS gauge_id,
-                               name AS gauge_name
-                        FROM gauges WHERE river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <gauge>
-                          <dc:attribute name="name" value="${gauge_name}"/>
-                          <dc:attribute name="db-id" value="${gauge_id}"/>
-                          <dc:context>
-                            <dc:statement>
-                              SELECT description   AS gauge_desc, 
-                                     d.id          AS discharge_id,
-                                     ti.start_time AS g_start, 
-                                     ti.stop_time  AS g_stop
-                              FROM discharge_tables d JOIN time_intervals ti 
-                              ON d.time_interval_id = ti.id
-                              WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
-                            </dc:statement>
-                            <dc:elements>
-                              <historical>
-                                <dc:attribute name="name" value="${gauge_desc}"/>
-                                <dc:attribute name="from" value="${g_start}"/>
-                                <dc:attribute name="to" value="${g_stop}"/>
-                                <dc:attribute name="db-id" value="${discharge_id}"/></historical>
-                            </dc:elements>
-                          </dc:context>
-                        </gauge>
-                      </dc:elements>
-                    </dc:context>
-                  </discharge-table-gauge>
-                  <fixations>
-                    <dc:attribute name="id" value="fixations-${river_id}"/>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id          AS fix_id,
-                               description AS fix_description
-                        FROM wsts WHERE kind = 2 AND river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <fixation>
-                          <dc:attribute name="name" value="${fix_description}"/>
-                          <dc:attribute name="db-id" value="${fix_id}"/>
-                          <columns>
-                            <dc:context>
-                              <dc:statement>
-                                SELECT id   AS fix_column_id,
-                                       name AS fix_column_name
-                                FROM wst_columns WHERE wst_id = ${fix_id}
-                                ORDER by position
-                              </dc:statement>
-                              <dc:elements>
-                                <column>
-                                  <dc:attribute name="name" value="${fix_column_name}"/>
-                                  <dc:attribute name="db-id" value="${fix_column_id}"/></column>
-                              </dc:elements>
-                            </dc:context>
-                          </columns>
-                        </fixation>
-                      </dc:elements>
-                    </dc:context>
-                  </fixations>
-                  <flood-protections>
-                    <dc:attribute name="id" value="flood-protections-${river_id}"/>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id          AS prot_id,
-                               description AS prot_description
-                        FROM wsts WHERE kind = 5 AND river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <flood-protection>
-                          <dc:attribute name="name" value="${prot_description}"/>
-                          <dc:attribute name="db-id" value="${prot_id}"/>
-                          <columns>
-                            <dc:context>
-                              <dc:statement>
-                                SELECT id   AS prot_column_id,
-                                       name AS prot_column_name
-                                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="db-id" value="${prot_column_id}"/></column>
-                              </dc:elements>
-                            </dc:context>
-                          </columns>
-                        </flood-protection>
-                      </dc:elements>
-                    </dc:context>
-                  </flood-protections>
-                  <flood-water-marks>
-                    <dc:attribute name="id" value="flood-water-marks-${river_id}"/>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id          AS fw_id,
-                               description AS fw_description
-                        FROM wsts WHERE kind = 4 AND river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <flood-water-mark>
-                          <dc:attribute name="name" value="${fw_description}"/>
-                          <dc:attribute name="db-id" value="${fw_id}"/>
-                          <columns>
-                            <dc:context>
-                              <dc:statement>
-                                SELECT id   AS fw_column_id,
-                                       name AS fw_column_name
-                                FROM wst_columns WHERE wst_id = ${fw_id}
-                                ORDER by position
-                              </dc:statement>
-                              <dc:elements>
-                                <column>
-                                  <dc:attribute name="name" value="${fw_column_name}"/>
-                                  <dc:attribute name="db-id" value="${fw_column_id}"/></column>
-                              </dc:elements>
-                            </dc:context>
-                          </columns>
-                        </flood-water-mark>
-                      </dc:elements>
-                    </dc:context>
-                  </flood-water-marks>
-                  <water-levels>
-                    <dc:attribute name="id" value="water-levels-${river_id}"/>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id          AS wl_id,
-                               description AS wl_description
-                        FROM wsts WHERE kind = 0 AND river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <water-level>
-                          <dc:attribute name="name" value="${wl_description}"/>
-                          <dc:attribute name="db-id" value="${wl_id}"/>
-                          <columns>
-                            <dc:context>
-                              <dc:statement>
-                                SELECT id   AS wl_column_id,
-                                       name AS wl_column_name
-                                FROM wst_columns WHERE wst_id = ${wl_id}
-                                ORDER by position
-                              </dc:statement>
-                              <dc:elements>
-                                <column>
-                                  <dc:attribute name="name" value="${wl_column_name}"/>
-                                  <dc:attribute name="db-id" value="${wl_column_id}"/></column>
-                              </dc:elements>
-                            </dc:context>
-                          </columns>
-                        </water-level>
-                      </dc:elements>
-                    </dc:context>
-                  </water-levels>
-                  <extra-longitudinal-sections>
-                    <dc:attribute name="id" value="extra-longitudinal-sections-${river_id}"/>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT id          AS els_id,
-                               description AS els_description
-                        FROM wsts WHERE kind = 1 AND river_id = ${river_id}
-                      </dc:statement>
-                      <dc:elements>
-                        <extra-longitudinal-section>
-                          <dc:attribute name="name" value="${els_description}"/>
-                          <dc:attribute name="db-id" value="${els_id}"/>
-                          <columns>
-                            <dc:context>
-                              <dc:statement>
-                                SELECT id   AS els_column_id,
-                                       name AS els_column_name
-                                FROM wst_columns WHERE wst_id = ${els_id}
-                                ORDER by position
-                              </dc:statement>
-                              <dc:elements>
-                                <column>
-                                    <dc:attribute name="name" value="${els_column_name}"/>
-                                    <dc:attribute name="db-id" value="${els_column_id}"/></column>
-                              </dc:elements>
-                            </dc:context>
-                          </columns>
-                        </extra-longitudinal-section>
-                      </dc:elements>
-                    </dc:context>
-                  </extra-longitudinal-sections>
-                </discharge-table-nn>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
-                <computed-discharge-curve>
-                  <mainvalue>
-                    <dc:attribute name="factory" value="mainvalue"/>
-                    <dc:attribute name="db-ids" value="${river_id}"/>
-                  </mainvalue>
-                </computed-discharge-curve>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
-                <longitudinal-section>
-                  <dc:call-macro name="longitudinal_section-recommended"/>
-                  <fixations><dc:attribute name="ref" value="fixations-${river_id}"/></fixations>
-                  <flood-protections><dc:attribute name="ref" value="flood-protections-${river_id}"/></flood-protections>
-                  <flood-water-marks><dc:attribute name="ref" value="flood-water-marks-${river_id}"/></flood-water-marks>
-                  <water-levels><dc:attribute name="ref" value="water-levels-${river_id}"/></water-levels>
-                  <extra-longitudinal-sections><dc:attribute name="ref" value="extra-longitudinal-sections-${river_id}"/></extra-longitudinal-sections>
-                </longitudinal-section>
-                <dc:macro name="longitudinal_section-recommended">
-                  <annotation>
-                            <dc:attribute name="factory" value="annotations"/>
-                            <dc:attribute name="ids" value="${river_id}"/>
-                  </annotation>
-                </dc:macro>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'floodmap')">
-                <floodmap>
-                <dc:choose>
-                    <dc:when test="dc:contains($parameters, 'recommended')">
-                      <dc:call-macro name="flood-map-recommended"/>
-                    </dc:when>
-                    <dc:otherwise>
-                      <dc:call-macro name="flood-map-complete"/>
-                    </dc:otherwise>
-                </dc:choose>
-                </floodmap>
-                <dc:macro name="flood-map-recommended">
-                  <dc:comment>
-                     FIXME: Following two macros look identical to me.
-                  </dc:comment>
-                    <kilometrage>
-                        <riveraxis>
-                            <dc:attribute name="factory" value="riveraxis"/>
-                            <dc:attribute name="ids" value="${river_id}"/>
-                        </riveraxis>
-                    </kilometrage>
-                    <rastermap>
-                        <background>
-                            <dc:attribute name="factory" value="wmsbackground"/>
-                            <dc:attribute name="ids" value="${river_id}"/>
-                        </background>
-                    </rastermap>
-                </dc:macro>
-                <dc:macro name="flood-map-complete">
-                    <kilometrage>
-                        <riveraxis>
-                            <dc:attribute name="factory" value="riveraxis"/>
-                            <dc:attribute name="ids" value="${river_id}"/>
-                        </riveraxis>
-                    </kilometrage>
-                    <rastermap>
-                        <background>
-                            <dc:attribute name="factory" value="wmsbackground"/>
-                            <dc:attribute name="ids" value="${river_id}"/>
-                        </background>
-                    </rastermap>
-                </dc:macro>
-            </dc:if>
-          </river>
-        </dc:elements>
-      </dc:context>
+        <dc:call-macro name="load-system"/>
     </dc:otherwise>
   </dc:choose>
 </datacage>

http://dive4elements.wald.intevation.org