changeset 1195:2b4de678e29a

Removed braindead points3d table flys-backend/trunk@2295 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 06 Jul 2011 15:35:38 +0000
parents 491892931761
children 46127af605ba
files flys-backend/ChangeLog flys-backend/doc/schema/postgresql.sql flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java flys-backend/src/main/java/de/intevation/flys/model/Point3d.java
diffstat 5 files changed, 48 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Wed Jul 06 12:56:59 2011 +0000
+++ b/flys-backend/ChangeLog	Wed Jul 06 15:35:38 2011 +0000
@@ -1,3 +1,26 @@
+2011-07-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Point3d.java: Deleted.
+	  Not needed (braindead).
+
+	* src/main/java/de/intevation/flys/model/CrossSectionPoint.java:
+	  Directly store the x/y values now.
+
+	* src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java:
+	  Removed registration of Point3d.
+
+	To update existing databases:
+
+	BEGIN;
+	  ALTER TABLE cross_section_points DROP COLUMN point3d_id;
+	  DROP SEQUENCE POINTS3D_ID_SEQ;
+	  DROP TABLE points3d;
+	  ALTER TABLE cross_section_points ADD COLUMN x NUMERIC NOT NULL;
+	  ALTER TABLE cross_section_points ADD COLUMN y NUMERIC NOT NULL;
+	  ALTER TABLE cross_section_points ADD CONSTRAINT
+		cross_section_points_cross_section_id_key2 UNIQUE (cross_section_id, x);
+	COMMIT;
+
 2011-07-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/CrossSection.java,
--- a/flys-backend/doc/schema/postgresql.sql	Wed Jul 06 12:56:59 2011 +0000
+++ b/flys-backend/doc/schema/postgresql.sql	Wed Jul 06 15:35:38 2011 +0000
@@ -272,25 +272,15 @@
     UNIQUE (km, river_id)            -- XXX: Maybe too hard?
 );
 
--- TODO: Use a geometry column in cross_section_points
-
-CREATE SEQUENCE POINTS3D_ID_SEQ;
-
-CREATE TABLE points3d (
-    id int     PRIMARY KEY NOT NULL,
-    x  NUMERIC NOT NULL,
-    y  NUMERIC NOT NULL,
-    z  NUMERIC NOT NULL
-);
-
 CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ;
 
 CREATE TABLE cross_section_points (
     id               int PRIMARY KEY NOT NULL,
     cross_section_id int NOT NULL REFERENCES cross_sections(id),
-    point3d_id       int NOT NULL REFERENCES points3d(id),
     col_pos          int NOT NULL,
-    UNIQUE (cross_section_id, point3d_id, col_pos),
+    x                NUMERIC NOT NULL,
+    y                NUMERIC NOT NULL
+    UNIQUE (cross_section_id, x),
     UNIQUE (cross_section_id, col_pos)
 );
 
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Wed Jul 06 12:56:59 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java	Wed Jul 06 15:35:38 2011 +0000
@@ -21,7 +21,6 @@
 import de.intevation.flys.model.MainValueType;
 import de.intevation.flys.model.NamedMainValue;
 import de.intevation.flys.model.MainValue;
-import de.intevation.flys.model.Point3d;
 import de.intevation.flys.model.Position;
 import de.intevation.flys.model.Range;
 import de.intevation.flys.model.River;
@@ -129,7 +128,6 @@
         cfg.addAnnotatedClass(MainValueType.class);
         cfg.addAnnotatedClass(NamedMainValue.class);
         cfg.addAnnotatedClass(MainValue.class);
-        cfg.addAnnotatedClass(Point3d.class);
         cfg.addAnnotatedClass(Position.class);
         cfg.addAnnotatedClass(Range.class);
         cfg.addAnnotatedClass(River.class);
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java	Wed Jul 06 12:56:59 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java	Wed Jul 06 15:35:38 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.model;
 
+import java.math.BigDecimal;
+
 import java.io.Serializable;
 
 import javax.persistence.Entity;
@@ -19,8 +21,9 @@
 {
     private Integer      id;
     private CrossSection crossSection;
-    private Point3d      point;
     private Integer      colPos;
+    private BigDecimal   x;
+    private BigDecimal   y;
 
     public CrossSectionPoint() {
     }
@@ -52,16 +55,6 @@
         this.crossSection = crossSection;
     }
 
-    @OneToOne
-    @JoinColumn(name = "point3d_id")
-    public Point3d getPoint() {
-        return point;
-    }
-
-    public void setPoint(Point3d point) {
-        this.point = point;
-    }
-
     @Column(name = "col_pos")
     public Integer getColPos() {
         return colPos;
@@ -70,5 +63,23 @@
     public void setColPos(Integer colPos) {
         this.colPos = colPos;
     }
+
+    @Column(name = "x")
+    public BigDecimal getX() {
+        return x;
+    }
+
+    public void setX(BigDecimal x) {
+        this.x = x;
+    }
+
+    @Column(name = "y")
+    public BigDecimal getY() {
+        return y;
+    }
+
+    public void setY(BigDecimal y) {
+        this.y = y;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/Point3d.java	Wed Jul 06 12:56:59 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-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;
-
-@Entity
-@Table(name = "points3d")
-public class Point3d
-implements   Serializable
-{
-    private Integer    id;
-    private BigDecimal x;
-    private BigDecimal y;
-    private BigDecimal z;
-
-    public Point3d() {
-    }
-
-    public Point3d(BigDecimal x, BigDecimal y, BigDecimal z) {
-        this.x = x;
-        this.y = y;
-        this.z = z;
-    }
-
-    @Id
-    @SequenceGenerator(
-        name           = "SEQUENCE_POINTS3D_ID_SEQ",
-        sequenceName   = "POINTS3D_ID_SEQ",
-        allocationSize = 1)
-    @GeneratedValue(
-        strategy  = GenerationType.SEQUENCE,
-        generator = "SEQUENCE_POINTS3D_ID_SEQ")
-    @Column(name = "id")
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    @Column(name = "x")
-    public BigDecimal getX() {
-        return x;
-    }
-
-    public void setX(BigDecimal x) {
-        this.x = x;
-    }
-
-    @Column(name = "y")
-    public BigDecimal getY() {
-        return y;
-    }
-
-    public void setY(BigDecimal y) {
-        this.y = y;
-    }
-
-    @Column(name = "z")
-    public BigDecimal getZ() {
-        return z;
-    }
-
-    public void setZ(BigDecimal z) {
-        this.z = z;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org