changeset 3321:a2a33eff93aa

Improved minfo db schema and added model classes for s/q relation. flys-backend/trunk@4622 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 07 Jun 2012 09:52:44 +0000
parents 8f905390c10d
children 6b94700ccf05
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/SQRelation.java flys-backend/src/main/java/de/intevation/flys/model/SQRelationValue.java
diffstat 6 files changed, 248 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Tue Jun 05 16:57:01 2012 +0000
+++ b/flys-backend/ChangeLog	Thu Jun 07 09:52:44 2012 +0000
@@ -1,3 +1,16 @@
+2012-06-07  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/schema/oracle-minfo.sql,
+	  doc/schema/oracle-drop-minfo.sql: Schema additions for MINFO s/q
+	  relation.
+
+	* src/main/java/de/intevation/flys/model/SQRelationValue.java,
+	  src/main/java/de/intevation/flys/model/SQRelation.java: New model
+	  classes for MINFO s/q relation.
+
+	* src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java:
+	  Registered new model classes.
+
 2012-06-05	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/GaugeLocation.java,
--- a/flys-backend/doc/schema/oracle-drop-minfo.sql	Tue Jun 05 16:57:01 2012 +0000
+++ b/flys-backend/doc/schema/oracle-drop-minfo.sql	Thu Jun 07 09:52:44 2012 +0000
@@ -39,6 +39,8 @@
 ALTER TABLE waterlevel_difference DROP CONSTRAINT fk_wd_unit_id;
 ALTER TABLE waterlevel_difference_column DROP CONSTRAINT fk_wdc_difference_id;
 ALTER TABLE waterlevel_difference_values DROP CONSTRAINT fk_wdv_column_id;
+ALTER TABLE sq_relation DROP CONSTRAINT fk_sqr_tinterval_id;
+ALTER TABLE sq_relation_value DROP CONSTRAINT fk_sqr_id;
 
 DROP TABLE bed_height_type;
 DROP TABLE location_system;
@@ -66,6 +68,8 @@
 DROP TABLE waterlevel_difference;
 DROP TABLE waterlevel_difference_column;
 DROP TABLE waterlevel_difference_values;
+DROP TABLE sq_relation;
+DROP TABLE sq_relation_value;
 
 DROP SEQUENCE BED_HEIGHT_TYPE_SEQ;
 DROP SEQUENCE LOCATION_SYSTEM_SEQ;
@@ -93,4 +97,5 @@
 DROP SEQUENCE WATERLEVEL_DIFFERENCE_ID_SEQ;
 DROP SEQUENCE WATERLEVEL_DIFF_COLUMN_ID_SEQ;
 DROP SEQUENCE WATERLEVEL_DIFF_VALUES_ID_SEQ;
-
+DROP SEQUENCE SQ_RELATION_ID_SEQ;
+DROP SEQUENCE SQ_RELATION_VALUES_ID_SEQ;
--- a/flys-backend/doc/schema/oracle-minfo.sql	Tue Jun 05 16:57:01 2012 +0000
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Thu Jun 07 09:52:44 2012 +0000
@@ -351,3 +351,29 @@
     CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id)
 );
 
+
+CREATE SEQUENCE SQ_RELATION_ID_SEQ;
+
+CREATE TABLE sq_relation (
+    id               NUMBER(38,0) NOT NULL,
+    time_interval_id NUMBER(38,0) NOT NULL,
+    description      VARCHAR(256),
+    PRIMARY KEY (id),
+    CONSTRAINT fk_sqr_tinterval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id)
+);
+
+
+CREATE SEQUENCE SQ_RELATION_VALUES_ID_SEQ;
+
+CREATE TABLE sq_relation_value (
+    id             NUMBER(38,0) NOT NULL,
+    sq_relation_id NUMBER(38,0) NOT NULL,
+    parameter      VARCHAR(16)  NOT NULL,
+    fraction       VARCHAR(32)  NOT NULL,
+    function       VARCHAR(32)  NOT NULL,
+    km             NUMBER(38,3) NOT NULL,
+    a              NUMBER       NOT NULL,
+    b              NUMBER(38,3) NOT NULL,
+    PRIMARY KEY (id),
+    CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id)
+);
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Tue Jun 05 16:57:01 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Thu Jun 07 09:52:44 2012 +0000
@@ -76,6 +76,8 @@
 import de.intevation.flys.model.SedimentDensityValue;
 import de.intevation.flys.model.SedimentYield;
 import de.intevation.flys.model.SedimentYieldValue;
+import de.intevation.flys.model.SQRelation;
+import de.intevation.flys.model.SQRelationValue;
 import de.intevation.flys.model.TimeInterval;
 import de.intevation.flys.model.Unit;
 import de.intevation.flys.model.Waterlevel;
@@ -294,6 +296,8 @@
         cfg.addAnnotatedClass(SedimentDensityValue.class);
         cfg.addAnnotatedClass(SedimentYield.class);
         cfg.addAnnotatedClass(SedimentYieldValue.class);
+        cfg.addAnnotatedClass(SQRelation.class);
+        cfg.addAnnotatedClass(SQRelationValue.class);
         cfg.addAnnotatedClass(TimeInterval.class);
         cfg.addAnnotatedClass(Unit.class);
         cfg.addAnnotatedClass(Waterlevel.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/SQRelation.java	Thu Jun 07 09:52:44 2012 +0000
@@ -0,0 +1,79 @@
+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.OneToMany;
+import javax.persistence.JoinColumn;
+import javax.persistence.GenerationType;
+
+
+@Entity
+@Table(name = "sq_relation")
+public class SQRelation implements Serializable {
+
+    private Integer id;
+
+    private TimeInterval timeInterval;
+
+    private String description;
+
+    private List<SQRelationValue> values;
+
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_SQ_ID_SEQ",
+        sequenceName   = "SQ_RELATION_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_SQ_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+
+    @Column(name = "description")
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+
+    @Column(name = "time_interval")
+    public TimeInterval getTimeInterval() {
+        return timeInterval;
+    }
+
+    public void setTimeInterval(TimeInterval timeInterval) {
+        this.timeInterval = timeInterval;
+    }
+
+
+    @OneToMany
+    @JoinColumn(name = "sq_relation_id")
+    public List<SQRelationValue> getValues() {
+        return values;
+    }
+
+    public void setValues(List<SQRelationValue> 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/SQRelationValue.java	Thu Jun 07 09:52:44 2012 +0000
@@ -0,0 +1,120 @@
+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.OneToOne;
+import javax.persistence.GenerationType;
+
+
+@Entity
+@Table(name = "sq_relation_value")
+public class SQRelationValue implements Serializable {
+
+    private Integer id;
+
+    private SQRelation sqRelation;
+
+    private String parameter;
+    private String fraction;
+    private String function;
+
+    private double km;
+    private double a;
+    private double b;
+
+
+    @Id
+    @SequenceGenerator(
+        name           = "SEQUENCE_SQ_VALUE_ID_SEQ",
+        sequenceName   = "SQ_RELATION_VALUES_ID_SEQ",
+        allocationSize = 1)
+    @GeneratedValue(
+        strategy  = GenerationType.SEQUENCE,
+        generator = "SEQUENCE_SQ_VALUE_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+
+    @OneToOne
+    @Column(name = "sq_relation_id")
+    public SQRelation getSQRelation() {
+        return sqRelation;
+    }
+
+    public void setSQRelation(SQRelation sqRelation) {
+        this.sqRelation = sqRelation;
+    }
+
+
+    @Column(name = "parameter")
+    public String getParameter() {
+        return parameter;
+    }
+
+    public void setParameter(String parameter) {
+        this.parameter = parameter;
+    }
+
+
+    @Column(name = "fraction")
+    public String getFraction() {
+        return fraction;
+    }
+
+    public void setFraction(String fraction) {
+        this.fraction = fraction;
+    }
+
+
+    @Column(name = "function")
+    public String getFunction() {
+        return function;
+    }
+
+    public void setFunction(String function) {
+        this.function = function;
+    }
+
+
+    @Column(name = "km")
+    public double getKm() {
+        return km;
+    }
+
+    public void setKm(double km) {
+        this.km = km;
+    }
+
+
+    @Column(name = "a")
+    public double getA() {
+        return a;
+    }
+
+    public void setA(double a) {
+        this.a = a;
+    }
+
+
+    @Column(name = "b")
+    public double getB() {
+        return b;
+    }
+
+    public void setB(double b) {
+        this.b = b;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org