# HG changeset patch # User Ingo Weinzierl # Date 1339062764 0 # Node ID a2a33eff93aa06ef4f6fcdb035aa4d25166d7de5 # Parent 8f905390c10dbff7265d10bf196eff5fa885f107 Improved minfo db schema and added model classes for s/q relation. flys-backend/trunk@4622 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 8f905390c10d -r a2a33eff93aa flys-backend/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/model/GaugeLocation.java, diff -r 8f905390c10d -r a2a33eff93aa flys-backend/doc/schema/oracle-drop-minfo.sql --- 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; diff -r 8f905390c10d -r a2a33eff93aa flys-backend/doc/schema/oracle-minfo.sql --- 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) +); diff -r 8f905390c10d -r a2a33eff93aa flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java --- 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); diff -r 8f905390c10d -r a2a33eff93aa flys-backend/src/main/java/de/intevation/flys/model/SQRelation.java --- /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 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 getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 8f905390c10d -r a2a33eff93aa flys-backend/src/main/java/de/intevation/flys/model/SQRelationValue.java --- /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 :