[Dive4elements-commits] [PATCH 2 of 5] Add uesg as specified to the datacage

Wald Commits scm-commit at wald.intevation.org
Wed Apr 3 15:34:43 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1364995864 -7200
# Node ID a11c6f680487ee200b45d963104f7dc1fc7778d7
# Parent  65fa2b22dc46357f75bde73dfbd05f6bdee4f138
Add uesg as specified to the datacage

diff -r 65fa2b22dc46 -r a11c6f680487 flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 03 15:30:45 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Apr 03 15:31:04 2013 +0200
@@ -1575,82 +1575,132 @@
           </dc:macro>
 
           <dc:macro name="flood-map-uesk">
-            <uesk>
-              <calculations>
-                <current>
-                  <bfg>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 111
-                        GROUP BY name, kind
-                      </dc:statement>
+            <dc:context>
+              <dc:statement>
+                SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
+              </dc:statement>
+              <dc:if test="dc:has-result()">
+              <uesk>
+                <calculations>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT DISTINCT 1 from floodmaps where river_id = ${river_id} 
+                      AND (kind = 112 OR kind = 111)
+                    </dc:statement>
+                    <dc:if test="dc:has-result()">
+                      <current>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 111
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <bfg>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </bfg>
+                          </dc:if>
+                        </dc:context>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 112
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <federal>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </federal>
+                          </dc:if>
+                        </dc:context>
+                      </current>
+                    </dc:if>
+                  </dc:context>
+                  <dc:context>
+                    <dc:statement>
+                      SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
+                      AND (kind = 122 OR kind = 121)
+                    </dc:statement>
+                    <dc:if test="dc:has-result()">
+                      <potential>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 121
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <bfg>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </bfg>
+                          </dc:if>
+                        </dc:context>
+                        <dc:context>
+                          <dc:statement>
+                            SELECT DISTINCT
+                            name AS name
+                            FROM floodmaps
+                            WHERE river_id = ${river_id} AND kind = 122
+                          </dc:statement>
+                          <dc:if test="dc:has-result()">
+                            <federal>
+                              <dc:for-each>
+                                <floodmaps factory="wmsfloodmapsfactory"
+                                  ids="{$river_id};{$name}"
+                                  name="{$name}"/>
+                              </dc:for-each>
+                            </federal>
+                          </dc:if>
+                        </dc:context>
+                      </potential>
+                    </dc:if>
+                  </dc:context>
+                </calculations>
+                <dc:context>
+                  <dc:statement>
+                    SELECT DISTINCT
+                    source AS source
+                    FROM floodmaps
+                    WHERE river_id = ${river_id} AND kind = 200
+                  </dc:statement>
+                  <dc:if test="dc:has-result()">
+                    <measurements>
                       <dc:for-each>
-                        <dc:if test="$uesg_exist>0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
+                        <year name="{$source}">
+                          <dc:context>
+                            <dc:statement>
+                              SELECT DISTINCT
+                              name AS name
+                              FROM floodmaps
+                              WHERE river_id = ${river_id} AND kind = 200 AND source =
+                              ${source}
+                            </dc:statement>
+                            <dc:for-each>
+                              <floodmaps factory="wmsfloodmapsfactory"
+                                ids="{$river_id};{$name}"
+                                name="{$name}"/>
+                            </dc:for-each>
+                          </dc:context>
+                        </year>
                       </dc:for-each>
-                    </dc:context>
-                  </bfg>
-                  <land>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 112
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist>0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </land>
-                </current>
-                <potentiel>
-                  <bfg>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 121
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist>0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </bfg>
-                  <land>
-                    <dc:context>
-                      <dc:statement>
-                        SELECT count(*) AS uesg_exist, name AS name
-                        FROM floodmaps
-                        WHERE river_id = ${river_id} AND kind = 122
-                        GROUP BY name, kind
-                      </dc:statement>
-                      <dc:for-each>
-                        <dc:if test="$uesg_exist>0">
-                          <floodmaps factory="wmsfloodmapsfactory"
-                                     ids="{$river_id};{$name}"
-                                     name="{$name}"/>
-                        </dc:if>
-                      </dc:for-each>
-                    </dc:context>
-                  </land>
-                </potentiel>
-              </calculations>
-            </uesk>
+                    </measurements>
+                  </dc:if>
+                </dc:context>
+              </uesk>
+            </dc:if>
+            </dc:context>
           </dc:macro>
 
           <dc:macro name="flood-map-catchments">


More information about the Dive4elements-commits mailing list