changeset 2837:8b910e3277b0

Added new model classes for sediment yield data. flys-backend/trunk@4269 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 18 Apr 2012 12:54:51 +0000
parents 6b541d85c5cf
children 75446c47ef77
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java flys-backend/src/main/java/de/intevation/flys/model/SedimentYield.java flys-backend/src/main/java/de/intevation/flys/model/SedimentYieldValue.java
diffstat 5 files changed, 329 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Wed Apr 18 12:53:45 2012 +0000
+++ b/flys-backend/ChangeLog	Wed Apr 18 12:54:51 2012 +0000
@@ -1,3 +1,13 @@
+2012-04-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/SedimentYield.java,
+	  src/main/java/de/intevation/flys/model/SedimentYieldValue.java,
+	  src/main/java/de/intevation/flys/model/GrainFraction.java: New model
+	  classes for sediment yield data.
+
+	* src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java:
+	  Registered new model classes.
+
 2012-04-18  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/schema/oracle-minfo.sql,
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Wed Apr 18 12:53:45 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Wed Apr 18 12:54:51 2012 +0000
@@ -50,6 +50,7 @@
 import de.intevation.flys.model.FlowVelocityModel;
 import de.intevation.flys.model.FlowVelocityModelValue;
 import de.intevation.flys.model.Gauge;
+import de.intevation.flys.model.GrainFraction;
 import de.intevation.flys.model.Hws;
 import de.intevation.flys.model.HYK;
 import de.intevation.flys.model.HYKEntry;
@@ -70,6 +71,8 @@
 import de.intevation.flys.model.RiverAxisKm;
 import de.intevation.flys.model.SedimentDensity;
 import de.intevation.flys.model.SedimentDensityValue;
+import de.intevation.flys.model.SedimentYield;
+import de.intevation.flys.model.SedimentYieldValue;
 import de.intevation.flys.model.TimeInterval;
 import de.intevation.flys.model.Unit;
 import de.intevation.flys.model.WstColumn;
@@ -256,6 +259,7 @@
         cfg.addAnnotatedClass(FlowVelocityModel.class);
         cfg.addAnnotatedClass(FlowVelocityModelValue.class);
         cfg.addAnnotatedClass(Gauge.class);
+        cfg.addAnnotatedClass(GrainFraction.class);
         cfg.addAnnotatedClass(Hws.class);
         cfg.addAnnotatedClass(HYK.class);
         cfg.addAnnotatedClass(HYKEntry.class);
@@ -276,6 +280,8 @@
         cfg.addAnnotatedClass(RiverAxisKm.class);
         cfg.addAnnotatedClass(SedimentDensity.class);
         cfg.addAnnotatedClass(SedimentDensityValue.class);
+        cfg.addAnnotatedClass(SedimentYield.class);
+        cfg.addAnnotatedClass(SedimentYieldValue.class);
         cfg.addAnnotatedClass(TimeInterval.class);
         cfg.addAnnotatedClass(Unit.class);
         cfg.addAnnotatedClass(WstColumn.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java	Wed Apr 18 12:54:51 2012 +0000
@@ -0,0 +1,99 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+
+import org.apache.log4j.Logger;
+
+
+@Entity
+@Table(name = "grain_fraction")
+public class GrainFraction
+implements   Serializable
+{
+    private static Logger logger = Logger.getLogger(GrainFraction.class);
+
+    private Integer id;
+
+    private String name;
+
+    private Double lower;
+    private Double upper;
+
+    private Unit unit;
+
+
+    public GrainFraction() {
+    }
+
+    public GrainFraction(String name, Double lower, Double upper, Unit unit) {
+        this.name  = name;
+        this.lower = lower;
+        this.upper = upper;
+        this.unit  = unit;
+    }
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_GRAIN_FRACTION_ID_SEQ",
+        sequenceName   = "GRAIN_FRACTION_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_GRAIN_FRACTION_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @Column(name = "name" )
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Column(name = "lower")
+    public Double getLower() {
+        return lower;
+    }
+
+    public void setLower(Double lower) {
+        this.lower = lower;
+    }
+
+    @Column(name = "upper")
+    public Double getUpper() {
+        return upper;
+    }
+
+    public void setUpper(Double upper) {
+        this.upper = upper;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "unit_id")
+    public Unit getUnit() {
+        return unit;
+    }
+
+    public void setUnit(Unit unit) {
+        this.unit = unit;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/SedimentYield.java	Wed Apr 18 12:54:51 2012 +0000
@@ -0,0 +1,121 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+
+import org.apache.log4j.Logger;
+
+
+@Entity
+@Table(name = "sediment_yield")
+public class SedimentYield
+implements   Serializable
+{
+    private static Logger logger = Logger.getLogger(SedimentYield.class);
+
+    private Integer id;
+
+    private River river;
+
+    private GrainFraction grainFraction;
+
+    private Unit unit;
+
+    private TimeInterval timeInterval;
+
+    private List<SedimentYieldValue> values;
+
+
+    public SedimentYield() {
+        this.values = new ArrayList<SedimentYieldValue>();
+    }
+
+    public SedimentYield(River river, Unit unit, TimeInterval timeInterval) {
+        this();
+
+        this.river        = river;
+        this.unit         = unit;
+        this.timeInterval = timeInterval;
+    }
+
+
+    public SedimentYield(
+        River         river,
+        Unit          unit,
+        TimeInterval  timeInterval,
+        GrainFraction grainFraction
+    ) {
+        this(river, unit, timeInterval);
+
+        this.grainFraction = grainFraction;
+    }
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_SEDIMENT_YIELD_ID_SEQ",
+        sequenceName   = "SEDIMENT_YIELD_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_SEDIMENT_YIELD_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "river_id")
+    public River getRiver() {
+        return river;
+    }
+
+    public void setRiver(River river) {
+        this.river = river;
+    }
+
+    @OneToOne
+    @JoinColumn(name="grain_fraction_id")
+    public GrainFraction getGrainFraction() {
+        return grainFraction;
+    }
+
+    public void setGrainFraction(GrainFraction grainFraction) {
+        this.grainFraction = grainFraction;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "unit_id")
+    public Unit getUnit() {
+        return unit;
+    }
+
+    public void setUnit(Unit unit) {
+        this.unit = unit;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "time_interval_id")
+    public TimeInterval getTimeInterval() {
+        return timeInterval;
+    }
+
+    public void setTimeInterval(TimeInterval timeInterval) {
+        this.timeInterval = timeInterval;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/SedimentYieldValue.java	Wed Apr 18 12:54:51 2012 +0000
@@ -0,0 +1,93 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+
+import org.apache.log4j.Logger;
+
+
+@Entity
+@Table(name = "sediment_yield_values")
+public class SedimentYieldValue
+implements   Serializable
+{
+    private static Logger logger = Logger.getLogger(SedimentYieldValue.class);
+
+    private Integer id;
+
+    private SedimentYield sedimentYield;
+
+    private Double station;
+    private Double value;
+
+    private Unit unit;
+
+
+    public SedimentYieldValue() {
+    }
+
+    public SedimentYieldValue(
+        SedimentYield sedimentYield,
+        Double        station,
+        Double        value
+    ) {
+        this.sedimentYield = sedimentYield;
+        this.station       = station;
+        this.value         = value;
+    }
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_SEDIMENT_YIELD_VALuES_ID_SEQ",
+        sequenceName   = "SEDIMENT_YIELD_VALUES_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_SEDIMENT_YIELD_VALuES_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "sediment_yield_id" )
+    public SedimentYield getSedimentYield() {
+        return sedimentYield;
+    }
+
+    public void setSedimentYield(SedimentYield sedimentYield) {
+        this.sedimentYield = sedimentYield;
+    }
+
+    @Column(name="station")
+    public Double getStation() {
+        return station;
+    }
+
+    public void setStation(Double station) {
+        this.station = station;
+    }
+
+    @Column(name = "value")
+    public Double getValue() {
+        return value;
+    }
+
+    public void setValue(Double value) {
+        this.value = value;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org