changeset 1657:91d038c7aae5

Bugfix: #328 Improved datacage configuration and labels for selected waterlevels. flys-artifacts/trunk@2854 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 28 Sep 2011 14:01:00 +0000
parents 94732906b094
children 7d11ad5a52d5
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/meta-data.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java
diffstat 3 files changed, 80 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Sep 28 09:17:20 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Sep 28 14:01:00 2011 +0000
@@ -1,3 +1,18 @@
+2011-09-28  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue328 (W-INFO / ÜSK: Auswahl der Wasserspiegellage / Auswahlunterstützung)
+
+	* doc/conf/meta-data.xml: Added an out 'waterlevels' that might be used to
+	  fetch user specific waterlevels (same as longitudinal sections, but
+	  without Q facet).
+	  In addition, the system specific datacage stuff is now fetched, when:
+	  a) no user-id is given
+	  b) a user-id is given and there is a parameter 'load-system'
+
+	* src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java:
+	  If the label of the WQKms object specified by the waterlevel selection
+	  begins with a "Q", the label is wrapped into a "W()", e.g. "W(Q=1200)".
+
 2011-09-28  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Made
--- a/flys-artifacts/doc/conf/meta-data.xml	Wed Sep 28 09:17:20 2011 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Wed Sep 28 14:01:00 2011 +0000
@@ -306,7 +306,7 @@
     <dc:when test="dc:contains($parameters, 'user-id')">
       <old_calculations>
         <dc:context connection="user">
-          <dc:statement>SELECT u.id AS user_id, c.id AS collection_id
+          <dc:statement>SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name
                         FROM collections c JOIN users u ON c.user_id = u.id
                         WHERE u.gid = CAST(${user-id} AS uuid)
                         ORDER BY c.creation DESC
@@ -321,6 +321,12 @@
               </dc:statement>
               <dc:elements>
                 <dc:choose>
+
+
+                  <dc:comment>
+                    Import longitudinal sections only if the ${artifact-out} is defined as 'longitudinal_section'
+                    ---------------------------------------------------------------------------------------------
+                  </dc:comment>
                   <dc:when test="dc:contains($artifact-outs, 'longitudinal_section')">
                     <dc:context>
                       <dc:statement>SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
@@ -346,21 +352,67 @@
                       </dc:elements>
                     </dc:context>
                   </dc:when>
+                  <dc:comment>
+                    Import of longitudinal sections finished
+                  </dc:comment>
+
+
+                  <dc:comment>
+                    Import Waterlevels only if the ${artifact-out} is defined as 'waterlevels'
+                    --------------------------------------------------------------------------
+                  </dc:comment>
+                  <dc:when test="dc:contains($artifact-outs, 'waterlevels')">
+                    <dc:context>
+                      <dc:statement>SELECT id AS out_id FROM outs WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
+                      </dc:statement>
+                      <dc:elements>
+                        <dc:context>
+                          <dc:statement>SELECT name AS facet_name, num as facet_num, description AS facet_description
+                                        FROM facets WHERE out_id = ${out_id} and name = 'longitudinal_section.w' ORDER BY num ASC, name DESC
+                          </dc:statement>
+                          <waterlevels>
+                            <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
+                            <dc:elements>
+                              <dc:element name="${facet_name}">
+                                <dc:attribute name="description" value="${facet_description}"/>
+                                <dc:attribute name="ids" value="${facet_num}"/>
+                                <dc:attribute name="factory" value="winfo"/>
+                                <dc:attribute name="artifact-id" value="${a_gid}"/>
+                                <dc:attribute name="out" value="longitudinal_section"/>
+                              </dc:element>
+                            </dc:elements>
+                          </waterlevels>
+                        </dc:context>
+                      </dc:elements>
+                    </dc:context>
+                  </dc:when>
+                  <dc:comment>
+                    Import of waterlevels finished
+                  </dc:comment>
+
                 </dc:choose>
               </dc:elements>
             </dc:context>
           </dc:elements>
         </dc:context>
       </old_calculations>
+
+
       <dc:comment>
-        System specific part
-        --------------------
+        Include System specific part when 'load-system' is in parameters.
+        -----------------------------------------------------------------
       </dc:comment>
-      <dc:call-macro name="load-system"/>
+      <dc:choose>
+        <dc:when test="dc:contains($parameters,'load-system')">
+          <dc:call-macro name="load-system"/>
+        </dc:when>
+      </dc:choose>
     </dc:when>
+
+
     <dc:comment>
-      System specific part only
-      -------------------------
+      Include System specific part only if no user ID is given.
+      ---------------------------------------------------------
     </dc:comment>
     <dc:otherwise>
         <dc:call-macro name="load-system"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java	Wed Sep 28 09:17:20 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java	Wed Sep 28 14:01:00 2011 +0000
@@ -129,7 +129,13 @@
         }
         catch (NumberFormatException nfe) { /* do nothing */ }
 
-        return new String[] { wqkms[idx].getName() };
+        String name = wqkms[idx].getName();
+
+        if (name != null && name.indexOf("Q") >= 0) {
+            name = "W(" + name + ")";
+        }
+
+        return new String[] { name };
     }
 
 

http://dive4elements.wald.intevation.org