diff flys-backend/src/main/java/de/intevation/flys/model/DGM.java @ 5210:908848b74d7e

SCHEME CHANGE: dgm now uses time intervals and ranges
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 08 Mar 2013 18:15:48 +0100
parents a2600507761e
children
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/DGM.java	Fri Mar 08 17:44:12 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/DGM.java	Fri Mar 08 18:15:48 2013 +0100
@@ -24,15 +24,15 @@
 @Table(name = "dem")
 public class DGM implements Serializable {
 
-    private Integer    id;
-    private Integer    srid;
+    private Integer      id;
+    private Integer      srid;
 
-    private River      river;
+    private River        river;
 
-    private BigDecimal lower;
-    private BigDecimal upper;
+    private Range        range;
+    private TimeInterval time_interval;
 
-    private String     path;
+    private String       path;
 
 
     public DGM() {
@@ -66,24 +66,6 @@
         return river;
     }
 
-    public void setLower(BigDecimal lower) {
-        this.lower = lower;
-    }
-
-    @Column(name = "lower")
-    public BigDecimal getLower() {
-        return lower;
-    }
-
-    public void setUpper(BigDecimal upper) {
-        this.upper = upper;
-    }
-
-    @Column(name = "upper")
-    public BigDecimal getUpper() {
-        return upper;
-    }
-
     public void setPath(String path) {
         this.path = path;
     }
@@ -120,8 +102,8 @@
 
         Query query = session.createQuery(
             "from DGM where river.name =:river and " +
-            "lower <=:lower and upper >=:lower and " +
-            "lower <=:upper and upper >=:upper");
+            "range.a <=:lower and range.b >=:lower and " +
+            "range.a <=:upper and range.b >=:upper");
         query.setParameter("river", river);
         query.setParameter("lower", new BigDecimal(lower));
         query.setParameter("upper", new BigDecimal(upper));
@@ -130,5 +112,27 @@
 
         return result.isEmpty() ? null : result.get(0);
     }
+
+    @OneToOne
+    @JoinColumn(name = "range_id")
+    public Range getRange() {
+        return range;
+    }
+
+    public void setRange(Range range) {
+        this.range = range;
+    }
+
+    @OneToOne
+    @JoinColumn(name = "time_interval_id")
+    public TimeInterval getTimeInterval() {
+        return time_interval;
+    }
+
+    public void setTimeInterval(TimeInterval time_interval) {
+        this.time_interval = time_interval;
+    }
+
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org