changeset 5595:85fd42e308e7

merge
author Bettina Gruenbauer <bettina@intevation.de>
date Mon, 08 Apr 2013 16:24:08 +0200
parents 7277bdacc4a9 (current diff) cf4cc385e7c6 (diff)
children 8fce35702908
files
diffstat 5 files changed, 154 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Apr 08 16:23:18 2013 +0200
+++ b/.hgtags	Mon Apr 08 16:24:08 2013 +0200
@@ -39,3 +39,4 @@
 a5f5599f6fd5e37975d71b8a323aadfeb8d017e6 2.9.14
 437109b3cf49ce83d5bd4d005c71509e966b8cf7 2.9.15
 2fa6da26a1421932608ab8c71ef51f260ad77acd 2.9.16
+3e8f7b4bdf20f2f96edaab593dfaaefe2add46f5 2.9.17
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Mon Apr 08 16:23:18 2013 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Mon Apr 08 16:24:08 2013 +0200
@@ -362,6 +362,7 @@
                         <facet name="bed_longitudinal_section.bed_diameter_sublayer"/>
                         <facet name="bed_longitudinal_section.manualpoints" />
                     	<facet name="bed_longitudinal_section.bedload_diameter"/>
+                        <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                     </facets>
                 </outputmode>
                 <outputmode name="bed_quality_export" description="output.bed_quality_export" type="export">
--- a/flys-artifacts/doc/conf/meta-data.xml	Mon Apr 08 16:23:18 2013 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Mon Apr 08 16:24:08 2013 +0200
@@ -729,6 +729,9 @@
               <dc:call-macro name="annotations_per_type"/>
               <dc:call-macro name="flow_velocity_measurements"/>
             </dc:if>
+            <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
+              <dc:call-macro name="annotations_per_type"/>
+            </dc:if>
             <dc:comment>
               MINFO bedheight middle
             </dc:comment>
@@ -2565,6 +2568,116 @@
               </bed_quality_load>
             </dc:macro>
 
+            <dc:macro name="bedquality-density">
+              <bed_quality_density>
+                <dc:for-each>
+                  <dc:context>
+                    <dc:call-macro name="range-filter">
+                      <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 = 'bed_longitudinal_section.sediment_density_toplayer' OR
+                              f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND
+                             f.out_id = o.id         AND
+                             o.artifact_id = ${a_id} AND
+                             a.id = ${a_id}
+                        </dc:statement>
+                        <dc:for-each>
+                          <dc:element name="${facet_name}">
+                            <dc:attribute name="factory" value="minfo"/>
+                            <dc:attribute name="description" value="${facet_description}"/>
+                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                            <dc:attribute name="artifact-id" value="${aid}"/>
+                            <dc:attribute name="out" value="bed_longitudinal_section"/>
+                          </dc:element>
+                        </dc:for-each>
+                      </dc:context>
+                    </dc:call-macro>
+                  </dc:context>
+                </dc:for-each>
+              </bed_quality_density>
+            </dc:macro>
+
+            <dc:macro name="bedquality-porosity">
+              <bed_quality_porosity>
+                <dc:for-each>
+                  <dc:context>
+                    <dc:call-macro name="range-filter">
+                      <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 = 'bed_longitudinal_section.porosity_toplayer' OR
+                              f.name = 'bed_longitudinal_section.porosity_sublayer') AND
+                             f.out_id = o.id         AND
+                             o.artifact_id = ${a_id} AND
+                             a.id = ${a_id}
+                        </dc:statement>
+                        <dc:for-each>
+                          <dc:element name="${facet_name}">
+                            <dc:attribute name="factory" value="minfo"/>
+                            <dc:attribute name="description" value="${facet_description}"/>
+                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                            <dc:attribute name="artifact-id" value="${aid}"/>
+                            <dc:attribute name="out" value="bed_longitudinal_section"/>
+                          </dc:element>
+                        </dc:for-each>
+                      </dc:context>
+                    </dc:call-macro>
+                  </dc:context>
+                </dc:for-each>
+              </bed_quality_porosity>
+            </dc:macro>
+
+            <dc:macro name="flow-velocity">
+              <flow-velocity>
+                <dc:for-each>
+                  <dc:context>
+                    <dc:call-macro name="range-filter">
+                      <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 = 'flow_velocity.totalchannel' OR
+                             f.name = 'flow_velocity.mainchannel' OR
+                             f.name = 'flow_velocity.totalchannel.filtered' OR
+                             f.name = 'flow_velocity.mainchannel.filtered') AND
+                             f.out_id = o.id         AND
+                             o.artifact_id = ${a_id} AND
+                             a.id = ${a_id}
+                        </dc:statement>
+                        <dc:for-each>
+                          <dc:element name="${facet_name}">
+                            <dc:attribute name="factory" value="minfo"/>
+                            <dc:attribute name="description" value="${facet_description}"/>
+                            <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                            <dc:attribute name="artifact-id" value="${aid}"/>
+                            <dc:attribute name="out" value="bed_longitudinal_section"/>
+                          </dc:element>
+                        </dc:for-each>
+                      </dc:context>
+                    </dc:call-macro>
+                  </dc:context>
+                </dc:for-each>
+              </flow-velocity>
+            </dc:macro>
+
 
             <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
               <dc:call-macro name="longitudinal"/>
@@ -2613,9 +2726,13 @@
             </dc:if>
             <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
               <dc:call-macro name="bedquality-bed"/>
+              <dc:call-macro name="bedquality-load"/>
             </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
+            <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
+              <dc:call-macro name="bedquality-bed"/>
               <dc:call-macro name="bedquality-load"/>
+              <dc:call-macro name="bedquality-density"/>
+              <dc:call-macro name="bedquality-porosity"/>
             </dc:if>
           </dc:context>
         </dc:call-macro>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/Recommendations.java	Mon Apr 08 16:23:18 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/Recommendations.java	Mon Apr 08 16:24:08 2013 +0200
@@ -20,6 +20,7 @@
 import org.w3c.dom.Node;
 
 import org.hibernate.Session;
+import org.hibernate.SessionFactory;
 
 import org.hibernate.jdbc.Work;
 
@@ -29,7 +30,7 @@
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 
-import de.intevation.flys.backend.SedDBSessionHolder;
+import de.intevation.flys.backend.SessionFactoryProvider;
 import de.intevation.flys.backend.SessionHolder;
 
 import de.intevation.artifactdatabase.data.StateData;
@@ -212,17 +213,26 @@
             public void execute(final Connection systemConnection)
             throws SQLException
             {
-                SedDBSessionHolder.HOLDER.get().doWork(new Work() {
-                    @Override
-                    public void execute(Connection sedDBConnection)
-                    throws SQLException
-                    {
-                        recommend(
-                            parameters, userId, result,
-                            systemConnection,
-                            sedDBConnection);
-                    }
-                });
+                SessionFactory sedDBFactory =
+                    SessionFactoryProvider.getSedDBSessionFactory();
+
+                Session sedDBSession = sedDBFactory.openSession();
+                try {
+                    sedDBSession.doWork(new Work() {
+                        @Override
+                        public void execute(Connection sedDBConnection)
+                        throws SQLException
+                        {
+                            recommend(
+                                parameters, userId, result,
+                                systemConnection,
+                                sedDBConnection);
+                        }
+                    });
+                }
+                finally {
+                    sedDBSession.close();
+                }
             }
         });
     }
@@ -250,8 +260,10 @@
             connections.add(new Builder.NamedConnection(
                 CONNECTION_SYSTEM, systemConnection, true));
 
-            connections.add(new Builder.NamedConnection(
-                CONNECTION_SEDDB, seddbConnection, true));
+            if (seddbConnection != null) {
+                connections.add(new Builder.NamedConnection(
+                    CONNECTION_SEDDB, seddbConnection, true));
+            }
 
             if (userConnection != null) {
                 connections.add(new Builder.NamedConnection(
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java	Mon Apr 08 16:23:18 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java	Mon Apr 08 16:24:08 2013 +0200
@@ -12,6 +12,7 @@
 import de.intevation.flys.artifacts.model.minfo.BedloadDiameterResult;
 import de.intevation.flys.exports.StyledSeriesBuilder;
 import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
 
 
@@ -182,6 +183,13 @@
                 (BedParametersResult) artifactAndFacet.getData(context),
                 artifactAndFacet, attr, visible);
         }
+        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+            doAnnotations(
+                (FLYSAnnotation) artifactAndFacet.getData(context),
+                 artifactAndFacet,
+                 attr,
+                 visible);
+        }
         else if (FacetTypes.IS.MANUALPOINTS(name)) {
             doPoints(artifactAndFacet.getData(context), artifactAndFacet, attr,
                 visible, YAXIS.W.idx);

http://dive4elements.wald.intevation.org