diff flys-artifacts/doc/conf/meta-data.xml @ 5364:51db7fbc2e77

Add HWS Lines and HWS Points folder structures to the datacage
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 21 Mar 2013 16:52:07 +0100
parents d43ef9f709cd
children f099ca10684e
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml	Thu Mar 21 17:37:41 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Thu Mar 21 16:52:07 2013 +0100
@@ -1260,40 +1260,264 @@
                   </dc:elements>
                 </dc:context>
               </dc:macro>
-              <dc:macro name="hwslines">
-                <dc:context>
-                  <dc:statement>
-                    SELECT count(*) as km_exists, name as name
-                    FROM hws_lines WHERE river_id = ${river_id} GROUP BY name
-                  </dc:statement>
-                   <dc:elements>
-                    <dc:if test="$km_exists>0">
-                      <line>
-                        <dc:attribute name="factory" value="wmshwslinesfactory"/>
-                        <dc:attribute name="ids" value="${river_id};${name}"/>
-                        <dc:attribute name="name" value="${name}"/>
-                      </line>
-                    </dc:if>
+
+              <dc:macro name="hwslines_by_kind">
+                <dc:comment>
+                  Call from a context where fed_name hws_kind hws_name and river_id is
+                  availble
+                </dc:comment>
+                <Durchlass>
+                  <dc:elements filter="$hws_kind=1">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwslinesfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
                   </dc:elements>
-                </dc:context>
+                </Durchlass>
+                <Damm>
+                  <dc:elements filter="$hws_kind=2">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwslinesfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
+                  </dc:elements>
+                </Damm>
+                <Graben>
+                  <dc:elements filter="$hws_kind=3">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwslinesfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
+                  </dc:elements>
+                </Graben>
               </dc:macro>
+
+              <dc:macro name="hwslines">
+                <hws_lines>
+                  <official>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT DISTINCT
+                        fs.name AS fed_name,
+                        fs.id AS fed_id
+                        FROM hws_lines hws
+                        JOIN fed_states fs ON hws.fed_state_id = fs.id
+                        WHERE river_id = ${river_id}
+                        AND hws.official=1
+                      </dc:statement>
+                      <dc:elements>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS hws_name,
+                            kind_id AS hws_kind
+                            FROM hws_lines
+                            WHERE river_id = ${river_id}
+                            AND official=1
+                            AND fed_state_id = ${fed_id} ORDER BY name
+                          </dc:statement>
+                          <fedstate>
+                            <dc:attribute name="description" value="${fed_name}"/>
+                            <dc:call-macro name="hwslines_by_kind"/>
+                          </fedstate>
+                        </dc:context>
+                      </dc:elements>
+                    </dc:context>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT distinct
+                        name AS hws_name,
+                        kind_id AS hws_kind
+                        FROM hws_lines
+                        WHERE river_id = ${river_id}
+                        AND official=1
+                        AND fed_state_id IS NULL
+                        ORDER BY name
+                      </dc:statement>
+                      <hws_fed_unknown>
+                        <dc:call-macro name="hwslines_by_kind"/>
+                      </hws_fed_unknown>
+                    </dc:context>
+                  </official>
+                  <inofficial>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT DISTINCT
+                        fs.name AS fed_name,
+                        fs.id AS fed_id
+                        FROM hws_lines hws
+                        JOIN fed_states fs ON hws.fed_state_id = fs.id
+                        WHERE river_id = ${river_id}
+                        AND hws.official=0
+                      </dc:statement>
+                      <dc:elements>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS hws_name,
+                            kind_id AS hws_kind
+                            FROM hws_lines
+                            WHERE river_id = ${river_id}
+                            AND official=0
+                            AND fed_state_id = ${fed_id} ORDER BY name
+                          </dc:statement>
+                          <fedstate>
+                            <dc:attribute name="description" value="${fed_name}"/>
+                            <dc:call-macro name="hwslines_by_kind"/>
+                          </fedstate>
+                        </dc:context>
+                      </dc:elements>
+                    </dc:context>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT distinct
+                        name AS hws_name,
+                        kind_id AS hws_kind
+                        FROM hws_lines
+                        WHERE river_id = ${river_id}
+                        AND official=0
+                        AND fed_state_id IS NULL ORDER BY name
+                      </dc:statement>
+                      <hws_fed_unknown>
+                        <dc:call-macro name="hwslines_by_kind"/>
+                      </hws_fed_unknown>
+                    </dc:context>
+                  </inofficial>
+              </hws_lines>
+            </dc:macro>
+
+              <dc:macro name="hwspoints_by_kind">
+                <dc:comment>
+                  Call from a context where fed_name hws_kind hws_name and river_id is
+                  availble
+                </dc:comment>
+                <Durchlass>
+                  <dc:elements filter="$hws_kind=1">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwspointsfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
+                  </dc:elements>
+                </Durchlass>
+                <Damm>
+                  <dc:elements filter="$hws_kind=2">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwspointsfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
+                  </dc:elements>
+                </Damm>
+                <Graben>
+                  <dc:elements filter="$hws_kind=3">
+                    <hws>
+                      <dc:attribute name="factory" value="wmshwspointsfactory"/>
+                      <dc:attribute name="ids" value="${river_id};${hws_name}"/>
+                      <dc:attribute name="name" value="${hws_name}"/>
+                    </hws>
+                  </dc:elements>
+                </Graben>
+              </dc:macro>
+
               <dc:macro name="hwspoints">
-                <dc:context>
-                  <dc:statement>
-                    SELECT count(*) as km_exists, name as name
-                    FROM hws_points WHERE river_id = ${river_id} GROUP BY name
-                  </dc:statement>
-                   <dc:elements>
-                    <dc:if test="$km_exists>0">
-                      <line>
-                        <dc:attribute name="factory" value="wmshwspointsfactory"/>
-                        <dc:attribute name="ids" value="${river_id};${name}"/>
-                        <dc:attribute name="name" value="${name}"/>
-                      </line>
-                    </dc:if>
-                  </dc:elements>
-                </dc:context>
-              </dc:macro>
+                <hws_points>
+                  <official>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT DISTINCT
+                        fs.name AS fed_name,
+                        fs.id AS fed_id
+                        FROM hws_points hws
+                        JOIN fed_states fs ON hws.fed_state_id = fs.id
+                        WHERE river_id = ${river_id}
+                        AND hws.official=1
+                      </dc:statement>
+                      <dc:elements>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS hws_name,
+                            kind_id AS hws_kind
+                            FROM hws_points
+                            WHERE river_id = ${river_id}
+                            AND official=1
+                            AND fed_state_id = ${fed_id} ORDER BY name
+                          </dc:statement>
+                          <fedstate>
+                            <dc:attribute name="description" value="${fed_name}"/>
+                            <dc:call-macro name="hwspoints_by_kind"/>
+                          </fedstate>
+                        </dc:context>
+                      </dc:elements>
+                    </dc:context>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT distinct
+                        name AS hws_name,
+                        kind_id AS hws_kind
+                        FROM hws_points
+                        WHERE river_id = ${river_id}
+                        AND official=1
+                        AND fed_state_id IS NULL
+                        ORDER BY name
+                      </dc:statement>
+                      <hws_fed_unknown>
+                        <dc:call-macro name="hwspoints_by_kind"/>
+                      </hws_fed_unknown>
+                    </dc:context>
+                  </official>
+                  <inofficial>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT DISTINCT
+                        fs.name AS fed_name,
+                        fs.id AS fed_id
+                        FROM hws_points hws
+                        JOIN fed_states fs ON hws.fed_state_id = fs.id
+                        WHERE river_id = ${river_id}
+                        AND hws.official=0
+                      </dc:statement>
+                      <dc:elements>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS hws_name,
+                            kind_id AS hws_kind
+                            FROM hws_points
+                            WHERE river_id = ${river_id}
+                            AND official=0
+                            AND fed_state_id = ${fed_id} ORDER BY name
+                          </dc:statement>
+                          <fedstate>
+                            <dc:attribute name="description" value="${fed_name}"/>
+                            <dc:call-macro name="hwspoints_by_kind"/>
+                          </fedstate>
+                        </dc:context>
+                      </dc:elements>
+                    </dc:context>
+                    <dc:context>
+                      <dc:statement>
+                        SELECT distinct
+                        name AS hws_name,
+                        kind_id AS hws_kind
+                        FROM hws_points
+                        WHERE river_id = ${river_id}
+                        AND official=0
+                        AND fed_state_id IS NULL ORDER BY name
+                      </dc:statement>
+                      <hws_fed_unknown>
+                        <dc:call-macro name="hwspoints_by_kind"/>
+                      </hws_fed_unknown>
+                    </dc:context>
+                  </inofficial>
+              </hws_points>
+            </dc:macro>
+
+
               <dc:macro name="flood-map-buildings">
                 <dc:context>
                   <dc:statement>
@@ -1454,12 +1678,8 @@
                     <dc:call-macro name="flood-map-qps"/>
                   </kilometrage>
                   <hws>
-                    <hws_lines>
-                      <dc:call-macro name="hwslines"/>
-                    </hws_lines>
-                    <hws_points>
-                      <dc:call-macro name="hwspoints"/>
-                    </hws_points>
+                    <dc:call-macro name="hwslines"/>
+                    <dc:call-macro name="hwspoints"/>
                   </hws>
                   <dc:call-macro name="flood-map-uesk"/>
                   <gaugelocations>

http://dive4elements.wald.intevation.org