changeset 2818:25ed1f18fcc4

Improved the MIFNO DB schema for morphological width and added model classes. flys-backend/trunk@4235 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 13 Apr 2012 12:33:26 +0000 (2012-04-13)
parents 8979f2294af9
children 0c2567626754
files flys-backend/ChangeLog flys-backend/doc/schema/oracle-drop-minfo.sql flys-backend/doc/schema/oracle-minfo.sql flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java flys-backend/src/main/java/de/intevation/flys/model/MorphologicalWidth.java flys-backend/src/main/java/de/intevation/flys/model/MorphologicalWidthValue.java
diffstat 6 files changed, 223 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Fri Apr 13 11:45:29 2012 +0000
+++ b/flys-backend/ChangeLog	Fri Apr 13 12:33:26 2012 +0000
@@ -1,3 +1,16 @@
+2012-04-13  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/schema/oracle-minfo.sql,
+	  doc/schema/oracle-drop-minfo.sql: Added new relations for MINFO specific
+	  morphological width.
+
+	* src/main/java/de/intevation/flys/model/MorphologicalWidth.java,
+	  src/main/java/de/intevation/flys/model/MorphologicalWidthValue.java: New
+	  model classes for morphological width.
+
+	* src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java:
+	  Registered new model classes.
+
 2012-04-13  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/schema/oracle-minfo.sql: Added a description field to table
--- a/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Apr 13 11:45:29 2012 +0000
+++ b/flys-backend/doc/schema/oracle-drop-minfo.sql	Fri Apr 13 12:33:26 2012 +0000
@@ -16,6 +16,9 @@
 ALTER TABLE sediment_density DROP CONSTRAINT fk_sd_depth_id;
 ALTER TABLE sediment_density DROP CONSTRAINT fk_sd_unit_id;
 ALTER TABLE sediment_density_values DROP CONSTRAINT fk_sdv_sediment_density_id;
+ALTER TABLE morphologic_width DROP CONSTRAINT fk_mw_river_id;
+ALTER TABLE morphologic_width DROP CONSTRAINT fk_mw_unit_id;
+ALTER TABLE morphologic_width_values DROP CONSTRAINT fk_mwv_morphologic_width_id;
 
 DROP TABLE bed_height_type;
 DROP TABLE location_system;
@@ -27,6 +30,8 @@
 DROP TABLE depths;
 DROP TABLE sediment_density;
 DROP TABLE sediment_density_values;
+DROP TABLE morphologic_width;
+DROP TABLE morphologic_width_values;
 
 DROP SEQUENCE BED_HEIGHT_TYPE_SEQ;
 DROP SEQUENCE LOCATION_SYSTEM_SEQ;
@@ -38,4 +43,6 @@
 DROP SEQUENCE DEPTHS_ID_SEQ;
 DROP SEQUENCE SEDIMENT_DENSITY_ID_SEQ;
 DROP SEQUENCE SEDIMENT_DENSITY_VALUES_ID_SEQ;
+DROP SEQUENCE MORPHOLOGIC_WIDTH_ID_SEQ;
+DROP SEQUENCE MORPH_WIDTH_VALUES_ID_SEQ;
 
--- a/flys-backend/doc/schema/oracle-minfo.sql	Fri Apr 13 11:45:29 2012 +0000
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Fri Apr 13 12:33:26 2012 +0000
@@ -142,3 +142,27 @@
     PRIMARY KEY(id),
     CONSTRAINT fk_sdv_sediment_density_id FOREIGN KEY(sediment_density_id) REFERENCES sediment_density(id)
 );
+
+
+CREATE SEQUENCE MORPHOLOGIC_WIDTH_ID_SEQ;
+
+CREATE TABLE morphologic_width (
+    id          NUMBER(38,0) NOT NULL,
+    river_id    NUMBER(38,0) NOT NULL,
+    unit_id     NUMBER(38,0) NOT NULL,
+    PRIMARY KEY(id),
+    CONSTRAINT fk_mw_river_id FOREIGN KEY(river_id) REFERENCES rivers(id),
+    CONSTRAINT fk_mw_unit_id FOREIGN KEY(unit_id) REFERENCES units(id)
+);
+
+
+CREATE SEQUENCE MORPH_WIDTH_VALUES_ID_SEQ;
+
+CREATE TABLE morphologic_width_values (
+    id                      NUMBER(38,0) NOT NULL,
+    morphologic_width_id    NUMBER(38,0) NOT NULL,
+    station                 NUMBER(38,3) NOT NULL,
+    width                   NUMBER(38,3) NOT NULL,
+    PRIMARY KEY(id),
+    CONSTRAINT fk_mwv_morphologic_width_id FOREIGN KEY (morphologic_width_id) REFERENCES morphologic_width(id)
+);
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Fri Apr 13 11:45:29 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Fri Apr 13 12:33:26 2012 +0000
@@ -54,6 +54,8 @@
 import de.intevation.flys.model.Line;
 import de.intevation.flys.model.LocationSystem;
 import de.intevation.flys.model.MainValueType;
+import de.intevation.flys.model.MorphologicalWidth;
+import de.intevation.flys.model.MorphologicalWidthValue;
 import de.intevation.flys.model.NamedMainValue;
 import de.intevation.flys.model.MainValue;
 import de.intevation.flys.model.Position;
@@ -253,6 +255,8 @@
         cfg.addAnnotatedClass(Line.class);
         cfg.addAnnotatedClass(LocationSystem.class);
         cfg.addAnnotatedClass(MainValueType.class);
+        cfg.addAnnotatedClass(MorphologicalWidth.class);
+        cfg.addAnnotatedClass(MorphologicalWidthValue.class);
         cfg.addAnnotatedClass(NamedMainValue.class);
         cfg.addAnnotatedClass(MainValue.class);
         cfg.addAnnotatedClass(Position.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/MorphologicalWidth.java	Fri Apr 13 12:33:26 2012 +0000
@@ -0,0 +1,85 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+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;
+
+
+@Entity
+@Table(name = "morphologic_width")
+public class MorphologicalWidth implements Serializable {
+
+    private Integer id;
+
+    private River river;
+
+    private Unit unit;
+
+    private List<MorphologicalWidthValue> values;
+
+
+    public MorphologicalWidth() {
+    }
+
+
+    public MorphologicalWidth(River river, Unit unit) {
+        this.river = river;
+        this.unit  = unit;
+    }
+
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_MORPHOLOGIC_WIDTH_ID_SEQ",
+        sequenceName   = "MORPHOLOGIC_WIDTH_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_MORPHOLOGIC_WIDTH_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 = "unit_id")
+    public Unit getUnit() {
+        return unit;
+    }
+
+    public void setUnit(Unit unit) {
+        this.unit = unit;
+    }
+
+    public List<MorphologicalWidthValue> getValues() {
+        return values;
+    }
+
+    public void setValues(List<MorphologicalWidthValue> values) {
+        this.values = values;
+    }
+}
+// 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/MorphologicalWidthValue.java	Fri Apr 13 12:33:26 2012 +0000
@@ -0,0 +1,90 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+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;
+
+
+@Entity
+@Table(name = "morphologic_width_values")
+public class MorphologicalWidthValue implements Serializable {
+
+    private Integer id;
+
+    private MorphologicalWidth morphologicalWidth;
+
+    private BigDecimal station;
+    private BigDecimal width;
+
+
+    public MorphologicalWidthValue() {
+    }
+
+
+    public MorphologicalWidthValue(
+        MorphologicalWidth morphologicalWidth,
+        BigDecimal         station,
+        BigDecimal         width
+    ) {
+        this.morphologicalWidth = morphologicalWidth;
+        this.station            = station;
+        this.width              = width;
+    }
+
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_MORPH_WIDTH_VALUES_ID_SEQ",
+        sequenceName   = "MORPH_WIDTH_VALUES_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_MORPH_WIDTH_VALUES_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+
+    @OneToOne
+    @JoinColumn(name = "morphologic_width_id")
+    public MorphologicalWidth getMorphologicalWidth() {
+        return morphologicalWidth;
+    }
+
+    public void setMorphologicalWidth(MorphologicalWidth width) {
+        this.morphologicalWidth = width;
+    }
+
+    @Column(name = "station")
+    public BigDecimal getStation() {
+        return station;
+    }
+
+    public void setStation(BigDecimal station) {
+        this.station = station;
+    }
+
+    @Column(name = "width")
+    public BigDecimal getWidth() {
+        return width;
+    }
+
+    public void setWidth(BigDecimal width) {
+        this.width = width;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org