changeset 825:e49494d97437

Fixed and completed ort and ortzuordnung model.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 18 Dec 2015 17:34:40 +0100
parents 6e5a0edba363
children 90343e38225f
files src/main/java/de/intevation/lada/model/Ortszuordnung.java src/main/java/de/intevation/lada/model/land/LOrtszuordnung.java src/main/java/de/intevation/lada/model/stamm/Ort.java
diffstat 3 files changed, 57 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/model/Ortszuordnung.java	Fri Dec 18 17:32:30 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/Ortszuordnung.java	Fri Dec 18 17:34:40 2015 +0100
@@ -4,9 +4,12 @@
 import java.sql.Timestamp;
 
 import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 
 
 /**
@@ -18,6 +21,8 @@
     private static final long serialVersionUID = 1L;
 
     @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id", unique=true, nullable=false)
     private Integer id;
 
     @Column(name="letzte_aenderung")
@@ -34,6 +39,12 @@
     @Column(name="probe_id")
     private Integer probeId;
 
+    @Transient
+    private boolean owner;
+
+    @Transient
+    private boolean readonly;
+
     public Ortszuordnung() {
     }
 
@@ -85,4 +96,20 @@
         this.probeId = probeId;
     }
 
+    public boolean isOwner() {
+        return owner;
+    }
+
+    public void setOwner(boolean owner) {
+        this.owner = owner;
+    }
+
+    public boolean isReadonly() {
+        return readonly;
+    }
+
+    public void setReadonly(boolean readonly) {
+        this.readonly = readonly;
+    }
+
 }
--- a/src/main/java/de/intevation/lada/model/land/LOrtszuordnung.java	Fri Dec 18 17:32:30 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/land/LOrtszuordnung.java	Fri Dec 18 17:34:40 2015 +0100
@@ -4,7 +4,10 @@
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 
 
 /**
@@ -15,9 +18,16 @@
 public class LOrtszuordnung extends de.intevation.lada.model.Ortszuordnung {
     private static final long serialVersionUID = 1L;
 
+    @OneToOne
+    @JoinColumn(name="probe_id", insertable=false, updatable=false)
+    private LProbe probe;
+
     @Column(name="tree_modified")
     private Timestamp treeModified;
 
+    @Transient
+    private Timestamp parentModified;
+
     public LOrtszuordnung() {
     }
 
@@ -28,4 +38,15 @@
     public void setTreeModified(Timestamp treeModified) {
         this.treeModified = treeModified;
     }
+
+    public Timestamp getParentModified() {
+        if (this.parentModified == null && this.probe != null) {
+            return this.probe.getTreeModified();
+        }
+        return this.parentModified;
+    }
+
+    public void setParentModified(Timestamp parentModified) {
+        this.parentModified = parentModified;
+    }
 }
--- a/src/main/java/de/intevation/lada/model/stamm/Ort.java	Fri Dec 18 17:32:30 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/stamm/Ort.java	Fri Dec 18 17:34:40 2015 +0100
@@ -32,7 +32,7 @@
     private String gemId;
 
     @Column(name="hoehe_land")
-    private float hoeheLand;
+    private Float hoeheLand;
 
     @Column(name="kda_id")
     private Integer kdaId;
@@ -47,12 +47,12 @@
 
     private String langtext;
 
-    private double latitude;
+    private Double latitude;
 
     @Column(name="letzte_aenderung")
     private Timestamp letzteAenderung;
 
-    private double longitude;
+    private Double longitude;
 
     @Column(name="mp_art")
     private String mpArt;
@@ -126,11 +126,11 @@
         this.gemId = gemId;
     }
 
-    public float getHoeheLand() {
+    public Float getHoeheLand() {
         return this.hoeheLand;
     }
 
-    public void setHoeheLand(float hoeheLand) {
+    public void setHoeheLand(Float hoeheLand) {
         this.hoeheLand = hoeheLand;
     }
 
@@ -174,11 +174,11 @@
         this.langtext = langtext;
     }
 
-    public double getLatitude() {
+    public Double getLatitude() {
         return this.latitude;
     }
 
-    public void setLatitude(double latitude) {
+    public void setLatitude(Double latitude) {
         this.latitude = latitude;
     }
 
@@ -190,11 +190,11 @@
         this.letzteAenderung = letzteAenderung;
     }
 
-    public double getLongitude() {
+    public Double getLongitude() {
         return this.longitude;
     }
 
-    public void setLongitude(double longitude) {
+    public void setLongitude(Double longitude) {
         this.longitude = longitude;
     }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)