diff flys-artifacts/doc/conf/meta-data.xml @ 1879:d7369f395a80

Somewhat unified user-part of dc config. flys-artifacts/trunk@3238 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 11 Nov 2011 11:59:41 +0000
parents 4fb81eb8b45b
children ebd16028efa3
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Nov 11 11:28:15 2011 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Nov 11 11:59:41 2011 +0000
@@ -587,141 +587,158 @@
       ------------------
     </dc:comment>
     <dc:when test="dc:contains($parameters, 'user-id')">
-      <dc:comment>
-        Show diffferences if longitudinal sections are there.
-        -----------------------------------------------------
-      </dc:comment>
-      <dc:choose>
-      <dc:when test="dc:contains($artifact-outs, 'longitudinal_section')">
-        <differences>
-        <dc:context>
+
+     <old_calculations>
+      <dc:context connection="user">
+        <dc:comment>
+           Get the user and collection-id.
+        </dc:comment>
         <dc:statement>
-          SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
-          FROM outs as o, facets as f, artifacts as a
-          WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = a.id;
+            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
         </dc:statement>
-            <dc:elements>
-              <dc:element name="${facet_name}">
-                <dc:attribute name="description" value="${facet_description}"/>
-                <dc:attribute name="factory"     value="winfo"/>
-                <dc:attribute name="artifact-id" value="${aid}"/>
-                <dc:attribute name="ids"         value="${aid}"/>
-                <dc:attribute name="out"         value="w_differences"/>
-              </dc:element>
-            </dc:elements>
-        </dc:context>
-	</differences>
-      </dc:when>
-      </dc:choose>
-      <old_calculations>
-        <dc:context connection="user">
-          <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
-          </dc:statement>
-          <dc:elements>
-            <dc:comment><!--
-            <hello_collection><dc:attribute name="description" value="Collection: id=${collection_id} name='${collection_name}'"/></hello_collection>
-            --></dc:comment>
-            <dc:context>
-              <dc:statement>SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
-                            FROM   master_artifacts m
-                            WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
-                            AND EXISTS (
-                                SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
-              </dc:statement>
-              <dc:elements>
-              <dc:comment><!--
-                <hello_artifact><dc:attribute name="description" value="Artifact UUID: ${a_gid}"/></hello_artifact>
-              --></dc:comment>
-                <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') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
-                    <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}
-                            ORDER BY num ASC, name DESC
-                          </dc:statement>
-                          <longitudinal_section_columns>
-                              <dc:attribute name="description" value="${river} ${a_creation}"/>
-                              <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>
-                          </longitudinal_section_columns>
-                        </dc:context>
-                      </dc:elements>
-                    </dc:context>
-                  </dc:when>
-                  <dc:comment>
-                    Import of longitudinal sections finished
-                  </dc:comment>
-
+        <dc:comment>
+          SHOW W-DIFFERENCES
+        </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:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
+          <differences>
+            <dc:elements>
+                <dc:context>
+                  <dc:statement>
+                    SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
+                    FROM   master_artifacts m
+                    WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
+                    AND EXISTS (
+                        SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
+                  </dc:statement>
+                  <dc:elements>
+                      <dc:context>
+                        <dc:statement>
+                          SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
+                          FROM outs as o, facets as f, artifacts as a
+                          WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
+                        </dc:statement>
+                        <dc:elements>
+                          <dc:element name="${facet_name}">
+                            <dc:attribute name="description" value="${facet_description}"/>
+                            <dc:attribute name="factory"     value="winfo"/>
+                            <dc:attribute name="artifact-id" value="${aid}"/>
+                            <dc:attribute name="ids"         value="${aid}"/>
+                            <dc:attribute name="out"         value="w_differences"/>
+                          </dc:element>
+                        </dc:elements>
+                      </dc:context>
+                  </dc:elements>
+                </dc:context>
+            </dc:elements>
+          </differences>
+        </dc:if>
 
-                </dc:choose>
-              </dc:elements>
-            </dc:context>
-          </dc:elements>
-        </dc:context>
+        <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
+          <waterlevels>
+            <dc:elements>
+              <dc:context>
+                 <dc:statement>
+                   SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
+                   FROM   master_artifacts m
+                   WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
+                   AND EXISTS (
+                       SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
+                 </dc:statement>
+                 <dc:elements>
+                   <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}
+                           ORDER BY num ASC, name DESC
+                         </dc:statement>
+                         <longitudinal_section_columns>
+                             <dc:attribute name="description" value="${river} ${a_creation}"/>
+                             <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>
+                         </longitudinal_section_columns>
+                       </dc:context>
+                     </dc:elements>
+                   </dc:context>
+                 </dc:elements>
+               </dc:context>
+             </dc:elements>
+          </waterlevels>
+        </dc:if>
+
+        <dc:comment>
+           WATERLEVELS - ONLY SHOW Ws
+        </dc:comment>
+
+        <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
+          <waterlevels>
+            <dc:elements>
+              <dc:context>
+                 <dc:statement>
+                   SELECT m.id AS a_id, m.state AS a_state, m.gid AS a_gid, m.creation AS a_creation
+                   FROM   master_artifacts m
+                   WHERE  m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
+                   AND EXISTS (
+                       SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
+                 </dc:statement>
+                 <dc:elements>
+
+                   <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:elements>
+                </dc:context>
+             </dc:elements>
+          </waterlevels>
+        </dc:if>
+
+      </dc:context>
       </old_calculations>
 
 

http://dive4elements.wald.intevation.org