# HG changeset patch
# User mschaefer
# Date 1525096812 -7200
# Node ID c16e90a0baf7998c5069d239f7751c754659028f
# Parent 8aa7d9eaaa218b85dbed2b8b9d4775ef0da94332
Added datacage select and chart display for modelled flow depth series loaded from database
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/conf.xml
--- a/artifacts/doc/conf/conf.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/conf.xml Mon Apr 30 16:00:12 2018 +0200
@@ -181,21 +181,19 @@
ttl="3600000"
artifact="org.dive4elements.river.artifacts.uinfo.UINFOArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory
-
-
-
-
- org.dive4elements.artifactdatabase.DefaultArtifactFactory
-
org.dive4elements.artifactdatabase.DefaultArtifactFactory
org.dive4elements.artifactdatabase.DefaultArtifactFactory
+ org.dive4elements.artifactdatabase.DefaultArtifactFactory
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml
--- a/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Mon Apr 30 16:00:12 2018 +0200
@@ -59,6 +59,7 @@
+
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/meta-data.xml Mon Apr 30 16:00:12 2018 +0200
@@ -1636,6 +1636,10 @@
+
+
+
+
@@ -3488,21 +3492,24 @@
- SELECT tc.tkh_id AS tkh_id, tc.id AS tkh_col_id, tc.name AS tkh_col_name,
- MIN(t.filename) AS tkh_name, MIN(tv.station) AS km_min, MAX(tv.station) AS km_max,
- MIN(t.filename) || '<br />' || MIN(t.sounding_info) || '<br />' || MIN(t.evaluation_by) AS info
- FROM tkh_column tc INNER JOIN tkh t ON tc.tkh_id=t.id
- INNER JOIN tkh_values tv ON tc.id=tv.tkh_column_id
- WHERE (t.river_id=${river_id})
- AND (lower(t.groupname)=${tkh_groupname})
- GROUP BY tc.tkh_id, tc.id
- ORDER BY tc.id
+ SELECT sc.tkh_id AS tkh_id, sc.id AS tkh_col_id, sc.name AS tkh_col_name,
+ MIN(s.filename) AS tkh_name, MIN(v.station) AS km_min, MAX(v.station) AS km_max,
+ MIN(s.filename) || '<br />'
+ || '[km ' || MIN(v.station) || ' - ' || MAX(v.station) || ']<br />'
+ || MIN(s.sounding_info) || '<br />'
+ || MIN(s.evaluation_by) AS info
+ FROM tkh_column sc INNER JOIN tkh s ON sc.tkh_id=s.id
+ INNER JOIN tkh_values v ON sc.id=v.tkh_column_id
+ WHERE (s.river_id=${river_id})
+ AND (lower(s.groupname)=${tkh_groupname})
+ GROUP BY sc.tkh_id, sc.id
+ ORDER BY sc.id
-
+
@@ -3530,9 +3537,10 @@
SELECT s.id AS depthevol_id, s.filename AS depthevol_name, MIN(v.station) AS km_min, MAX(v.station) AS km_max,
s.filename || '<br />'
+ || '[km ' || MIN(v.station) || ' - ' || MAX(v.station) || ']<br />'
|| MIN(s.start_year) || ' - ' || MIN(s.reference_year) || '<br />'
|| MIN(s.old_sounding) || ' - ' || MIN(s.curr_sounding) || '<br />'
- || MIN(s.old_glw) || ' - ' || MIN(s.curr_glw) AS info
+ || MIN(s.old_glw) || ' - ' || MIN(s.curr_glw) AS info
FROM depth_evolution s INNER JOIN depth_evolution_values v ON s.id=v.depth_evolution_id
WHERE (s.river_id=${river_id})
AND (lower(s.groupname)=${depthevol_groupname})
@@ -3540,10 +3548,42 @@
ORDER BY s.id
-
+
+
+
+
+
+
+
+
+
+ SELECT sc.flow_depth_id AS flowdepth_id, sc.id AS flowdepth_col_id, sc.name AS flowdepth_col_name,
+ MIN(s.filename) AS flowdepth_name, MIN(v.station) AS km_min, MAX(v.station) AS km_max,
+ MIN(s.filename) || '<br />'
+ || '[km ' || MIN(v.station) || ' - ' || MAX(v.station) || ']<br />'
+ || MIN(s.sounding_info) || '<br />'
+ || MIN(s.evaluation_by) AS info
+ FROM flow_depth_column sc INNER JOIN flow_depth s ON sc.flow_depth_id=s.id
+ INNER JOIN flow_depth_values v ON sc.id=v.flow_depth_column_id
+ WHERE (s.river_id=${river_id})
+ GROUP BY sc.flow_depth_id, sc.id
+ ORDER BY sc.id
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/themes.xml
--- a/artifacts/doc/conf/themes.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/themes.xml Mon Apr 30 16:00:12 2018 +0200
@@ -444,5 +444,6 @@
+
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/themes/default.xml
--- a/artifacts/doc/conf/themes/default.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/themes/default.xml Mon Apr 30 16:00:12 2018 +0200
@@ -3020,4 +3020,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/doc/conf/themes/second.xml
--- a/artifacts/doc/conf/themes/second.xml Mon Apr 30 10:13:15 2018 +0200
+++ b/artifacts/doc/conf/themes/second.xml Mon Apr 30 16:00:12 2018 +0200
@@ -3008,4 +3008,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/PredefinedFlowDepthProcessor.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/PredefinedFlowDepthProcessor.java Mon Apr 30 16:00:12 2018 +0200
@@ -0,0 +1,77 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.sinfo.common;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.sinfo.predefinedflowdepth.PredefinedFlowDepthQueryCalculationResult;
+import org.dive4elements.river.exports.DiagramGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.themes.ThemeDocument;
+
+/**
+ * Processor to generate a data series for flow depth data loaded from the database
+ *
+ * @author Matthias Schäfer
+ *
+ */
+public class PredefinedFlowDepthProcessor extends AbstractSInfoProcessor {
+
+ private final static Logger log = Logger.getLogger(PredefinedFlowDepthProcessor.class);
+
+ public static final String FACET_PREDEFINED_FLOW_DEPTH = "sinfo_facet_predefined_flowdepth";
+
+ private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";
+
+ private static final Set HANDLED_FACET_TYPES = new HashSet<>();
+
+ static {
+ HANDLED_FACET_TYPES.add(FACET_PREDEFINED_FLOW_DEPTH);
+ }
+
+ public PredefinedFlowDepthProcessor() {
+ super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
+ }
+
+ @Override
+ protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) {
+
+ final CallContext context = generator.getCallContext();
+ final Map metaData = bundle.getFacet().getMetaData();
+
+ final Artifact artifact = bundle.getArtifact();
+
+ final StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
+ series.putMetaData(metaData, artifact, context);
+
+ final String facetName = bundle.getFacetName();
+ final PredefinedFlowDepthQueryCalculationResult data = (PredefinedFlowDepthQueryCalculationResult) bundle.getData(context);
+ if (data == null) {
+ // Check has been here before so we keep it for security reasons
+ // this should never happen though.
+ throw new IllegalStateException("Data is null for facet: " + facetName);
+ }
+
+ final double[][] points = data.getStationPoints(SInfoResultType.flowdepth);
+
+ StyledSeriesBuilder.addPoints(series, points, true);
+ generator.addAxisSeries(series, getAxisName(), visible);
+
+ return null;
+ }
+}
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthArtifact.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthArtifact.java Mon Apr 30 16:00:12 2018 +0200
@@ -0,0 +1,130 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.sinfo.predefinedflowdepth;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.DefaultOutput;
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifactdatabase.state.FacetActivity;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.ArtifactFactory;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.AbstractStaticStateArtifact;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.sinfo.common.PredefinedFlowDepthProcessor;
+import org.dive4elements.river.artifacts.states.StaticState;
+import org.dive4elements.river.model.sinfo.FlowDepthColumn;
+import org.w3c.dom.Document;
+
+/**
+ * Display of a flow depth data series loaded from database
+ *
+ * @author Matthias Schäfer
+ *
+ */
+public class PredefinedFlowDepthArtifact extends AbstractStaticStateArtifact implements FacetTypes {
+
+ /** The log for this class. */
+ private static Logger log = Logger.getLogger(PredefinedFlowDepthArtifact.class);
+
+ /** Artifact name. */
+ private static final String NAME = "flowdepthx";
+
+ static {
+ // TODO: Move to configuration.
+ FacetActivity.Registry.getInstance().register(NAME, FacetActivity.INACTIVE);
+ }
+
+ public static final String STATIC_STATE_NAME = "state.predefined_flowdepth.static";
+
+ /**
+ * Trivial Constructor.
+ */
+ public PredefinedFlowDepthArtifact() {
+ log.debug("new PredefinedFLowDepthArtifact");
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ /**
+ * Gets called from factory, to set things up.
+ */
+ @Override
+ public void setup(final String identifier, final ArtifactFactory factory, final Object context, final CallMeta callMeta, final Document data,
+ final List loadFacets) {
+
+ log.debug("PredefinedFlowDepthArtifact.setup");
+
+ if (log.isDebugEnabled()) {
+ log.debug(XMLUtils.toString(data));
+ }
+
+ final String code = getDatacageIDValue(data);
+
+ createFacets(callMeta, code);
+
+ super.setup(identifier, factory, context, callMeta, data, loadFacets);
+ }
+
+ private void createFacets(final CallMeta callMeta, final String code) {
+ if (code == null)
+ return;
+ final String[] parts = code.split("-");
+ if (parts.length < 3) {
+ log.error("Invalid datacage ID '" + code + "'");
+ return;
+ }
+ addStringData("flowdepth_col_id", parts[1]);
+ addStringData("flowdepth_id", parts[2]);
+ final FlowDepthColumn col = FlowDepthColumn.getColumnById(Integer.parseInt(parts[1]));
+
+ final ArrayList facets = new ArrayList<>(1);
+ facets.add(new PredefinedFlowDepthFacet(PredefinedFlowDepthProcessor.FACET_PREDEFINED_FLOW_DEPTH,
+ col.getName() + " (" + col.getSeries().getFilename() + ")"));
+ addFacets(STATIC_STATE_NAME, facets);
+ }
+
+ @Override
+ protected void initStaticState() {
+
+ log.debug("initStaticState " + getName() + " " + identifier());
+
+ final StaticState state = new StaticState(STATIC_STATE_NAME);
+ final DefaultOutput output = new DefaultOutput("general", "general", "image/png", "chart");
+
+ final List facets = getFacets(STATIC_STATE_NAME);
+ output.addFacets(facets);
+ state.addOutput(output);
+
+ setStaticState(state);
+ }
+
+ @Override
+ protected void initialize(final Artifact artifact, final Object context, final CallMeta meta) {
+ // do not clone facets, etc. from master artifact
+
+ log.debug("initialize");
+ importData((D4EArtifact) artifact, "river");
+ importData((D4EArtifact) artifact, "ld_from");
+ importData((D4EArtifact) artifact, "ld_to");
+
+ log.debug("ld_from " + getDataAsString("ld_from"));
+ log.debug("ld_to " + getDataAsString("ld_to"));
+ }
+}
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthColumnAccess.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthColumnAccess.java Mon Apr 30 16:00:12 2018 +0200
@@ -0,0 +1,68 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.sinfo.predefinedflowdepth;
+
+import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+
+/**
+ * Access to the database loaded flow depth column artifact data
+ *
+ * @author Matthias Schäfer
+ */
+final class PredefinedFlowDepthColumnAccess extends RangeAccess {
+
+ /***** FIELDS *****/
+
+ private Integer columnId;
+
+ private Integer seriesId;
+
+ private String name;
+
+
+ /***** CONSTRUCTORS *****/
+
+ public PredefinedFlowDepthColumnAccess(final D4EArtifact artifact) {
+ super(artifact);
+ }
+
+
+ /***** METHDOS *****/
+
+ public DoubleRange getRange() {
+ final double from = getFrom();
+ final double to = getTo();
+ return new DoubleRange(from, to);
+ }
+
+ public Integer getSeriesId() {
+ if (this.seriesId == null) {
+ this.seriesId = getInteger("flowdepth_id");
+ }
+ return this.columnId;
+ }
+
+ public Integer getColumnId() {
+ if (this.columnId == null) {
+ this.columnId = getInteger("flowdepth_col_id");
+ }
+ return this.columnId;
+ }
+
+ public String getName() {
+ if (this.name == null) {
+ this.name = getString("name");
+ }
+ return this.name;
+ }
+}
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthFacet.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthFacet.java Mon Apr 30 16:00:12 2018 +0200
@@ -0,0 +1,80 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.sinfo.predefinedflowdepth;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
+import org.dive4elements.river.artifacts.model.BlackboardDataFacet;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
+import org.dive4elements.river.model.sinfo.FlowDepthColumn;
+import org.dive4elements.river.model.sinfo.FlowDepthValue;
+
+/**
+ * Facet for a flow depth value series loaded from the database
+ *
+ * @author Matthias Schäfer
+ */
+public class PredefinedFlowDepthFacet extends BlackboardDataFacet implements FacetTypes {
+
+ private static final long serialVersionUID = -5314814229001970855L;
+
+ public PredefinedFlowDepthFacet(final String name, final String description) {
+ super(0, name, description);
+
+ this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+ this.metaData.put("Y", "chart.flow_depth.section.yaxis.label");
+ }
+
+ /**
+ * Returns the data this facet requires.
+ *
+ * @param artifact
+ * the owner artifact.
+ * @param context
+ * the CallContext (ignored).
+ *
+ * @return
+ * the data as PredefinedFlowDepthQueryCalculationResult
+ */
+ @Override
+ public Object getData(final Artifact artifact, final CallContext context) {
+
+ final PredefinedFlowDepthColumnAccess access = new PredefinedFlowDepthColumnAccess((D4EArtifact) artifact);
+ final FlowDepthColumn series = FlowDepthColumn.getColumnById(access.getColumnId());
+ final List values = FlowDepthValue.getValues(series, access.getFrom(true), access.getTo(true));
+ final Collection rows = new ArrayList<>();
+ for (final FlowDepthValue value : values) {
+ rows.add(ResultRow.create().putValue(GeneralResultType.station, value.getStation()) //
+ .putValue(SInfoResultType.flowdepth, value.getDepth()));
+ }
+ return new PredefinedFlowDepthQueryCalculationResult(series.getName(), rows);
+ }
+
+ /**
+ * Create a deep copy of this Facet.
+ *
+ * @return a deep copy.
+ */
+ @Override
+ public PredefinedFlowDepthFacet deepCopy() {
+ final PredefinedFlowDepthFacet copy = new PredefinedFlowDepthFacet(this.name, this.description);
+ copy.set(this);
+ return copy;
+ }
+}
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthQueryCalculationResult.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefinedflowdepth/PredefinedFlowDepthQueryCalculationResult.java Mon Apr 30 16:00:12 2018 +0200
@@ -0,0 +1,29 @@
+/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.sinfo.predefinedflowdepth;
+
+import java.util.Collection;
+
+import org.dive4elements.river.artifacts.common.ResultRow;
+import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult;
+
+/**
+ * Contains the results of a database query of a tkh series
+ *
+ * @author Matthias Schäfer
+ */
+public final class PredefinedFlowDepthQueryCalculationResult extends AbstractSInfoCalculationResult {
+
+ private static final long serialVersionUID = 1L;
+
+ public PredefinedFlowDepthQueryCalculationResult(final String label, final Collection rows) {
+ super(label, null, rows);
+ }
+}
\ No newline at end of file
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthColumn.java
--- a/backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthColumn.java Mon Apr 30 10:13:15 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthColumn.java Mon Apr 30 16:00:12 2018 +0200
@@ -23,6 +23,11 @@
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.dive4elements.river.backend.SessionHolder;
+import org.hibernate.Query;
+import org.hibernate.Session;
/**
* Hibernate binding for the DB table flow_depth_column
@@ -77,6 +82,11 @@
return this.parent;
}
+ @Transient
+ public FlowDepth getSeries() {
+ return getFlowDepth();
+ }
+
public void setFlowDepth(final FlowDepth flow_depth) {
this.parent = flow_depth;
}
@@ -103,4 +113,15 @@
public void addValue(final FlowDepthValue value) {
this.values.add(value);
}
+
+ /**
+ * Selects a flow depth series column by id from the database
+ */
+ public static FlowDepthColumn getColumnById(final int id) {
+ final Session session = SessionHolder.HOLDER.get();
+ final Query query = session.createQuery("FROM FlowDepthColumn WHERE id=:id");
+ query.setParameter("id", id);
+ final List rows = query.list();
+ return (rows != null) ? rows.get(0) : null;
+ }
}
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthValue.java
--- a/backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthValue.java Mon Apr 30 10:13:15 2018 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/FlowDepthValue.java Mon Apr 30 16:00:12 2018 +0200
@@ -11,6 +11,7 @@
package org.dive4elements.river.model.sinfo;
import java.io.Serializable;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -22,6 +23,10 @@
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import org.dive4elements.river.backend.SessionHolder;
+import org.hibernate.Query;
+import org.hibernate.Session;
+
/**
* Hibernate binding for the DB table flow_depth_values
@@ -109,4 +114,17 @@
public void setDepth(final Double depth) {
this.depth = depth;
}
+
+ /**
+ * Selects the flow depth values of a flow depth series column in a km range from the database
+ */
+ public static List getValues(final FlowDepthColumn parent, final double kmLo, final double kmHi) {
+ final Session session = SessionHolder.HOLDER.get();
+ final Query query = session.createQuery("FROM FlowDepthValue WHERE (flowDepthColumn=:parent)"
+ + " AND (station >= :kmLo - 0.0001) AND (station <= :kmHi + 0.0001)");
+ query.setParameter("parent", parent);
+ query.setParameter("kmLo", new Double(kmLo));
+ query.setParameter("kmHi", new Double(kmHi));
+ return query.list();
+ }
}
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Mon Apr 30 10:13:15 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Mon Apr 30 16:00:12 2018 +0200
@@ -1498,6 +1498,8 @@
String predefined_depthevol_etappe();
+ String sinfo_predefined_flowdepth();
+
String uinfo();
String uinfo_salix_line_export();
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Mon Apr 30 10:13:15 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Mon Apr 30 16:00:12 2018 +0200
@@ -800,6 +800,8 @@
predefined_depthevol_aktuell = Bezug aktueller GlW
predefined_depthevol_etappe = GlW-Etappen
+sinfo_predefined_flowdepth = Modellierte Flie\u00dftiefen
+
uinfo = U-INFO
uinfo_inundation_duration_export = \u00dcberflutungsdauern Export
uinfo_salix_line_export = Salix-Linie Export
diff -r 8aa7d9eaaa21 -r c16e90a0baf7 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Apr 30 10:13:15 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Apr 30 16:00:12 2018 +0200
@@ -800,6 +800,8 @@
predefined_depthevol_aktuell = Bezug aktueller GlW
predefined_depthevol_etappe = GlW-Etappen
+sinfo_predefined_flowdepth = Modellierte Flie\u00dftiefen
+
uinfo = U-INFO
uinfo_inundation_duration_export = \u00dcberflutungsdauern Export
uinfo_salix_line_export = Salix-Linie Export