diff backend/src/main/java/org/dive4elements/river/model/sinfo/DailyDischarge.java @ 8971:50416a0df385

Importer for the Schifffahrt (S-INFO) and Oekologie (U-INFO) files
author mschaefer
date Tue, 03 Apr 2018 10:18:30 +0200
parents
children 4c5eeaff554c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/backend/src/main/java/org/dive4elements/river/model/sinfo/DailyDischarge.java	Tue Apr 03 10:18:30 2018 +0200
@@ -0,0 +1,147 @@
+/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.model.sinfo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.dive4elements.river.model.Gauge;
+
+/**
+ * Hibernate binding for the DB table daily_discharge
+ *
+ * @author Matthias Schäfer
+ *
+ */
+
+
+@Entity
+@Table(name = "daily_discharge")
+public class DailyDischarge implements Serializable {
+
+    /***** FIELDS *****/
+
+    private static final long serialVersionUID = -3687154040155547884L;
+
+    private Integer id;
+
+    // private String kmrange_info;
+
+    private String filename;
+
+    // private String comment;
+
+    private Gauge gauge;
+
+    private List<DailyDischargeValue> values;
+
+
+    /***** CONSTRUCTORS *****/
+
+    public DailyDischarge() {
+    }
+
+
+    public DailyDischarge(final Gauge gauge, final String filename, final String comment) {
+        this.gauge = gauge;
+        // this.river = river;
+        this.filename = filename;
+        // this.comment = comment;
+        this.values = new ArrayList<>();
+    }
+
+    /***** METHODS *****/
+
+    @Id
+    @SequenceGenerator(name = "SEQUENCE_DAILY_DISCHARGE_ID_SEQ", sequenceName = "DAILY_DISCHARGE_ID_SEQ", allocationSize = 1)
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE_DAILY_DISCHARGE_ID_SEQ")
+    @Column(name = "id")
+    public Integer getId() {
+        return this.id;
+    }
+
+    public void setId(final Integer id) {
+        this.id = id;
+    }
+
+    // @OneToOne
+    // @JoinColumn(name = "river_id")
+    // public River getRiver() {
+    // return this.river;
+    // }
+
+    // public void setRiver(final River river) {
+    // this.river = river;
+    // }
+
+    @OneToOne
+    @JoinColumn(name = "gauge_id")
+    public Gauge getGauge() {
+        return this.gauge;
+    }
+
+    public void setGauge(final Gauge gauge) {
+        this.gauge = gauge;
+    }
+
+    @Column(name = "filename")
+    public String getFilename() {
+        return this.filename;
+    }
+
+    public void setFilename(final String filename) {
+        this.filename = filename;
+    }
+
+    // @Column(name = "kmrange_info")
+    // public String getKmrange_info() {
+    // return this.kmrange_info;
+    // }
+
+    // public void setKmrange_info(final String kmrange_info) {
+    // this.kmrange_info = kmrange_info;
+    // }
+
+    // @Column(name = "comment")
+    // public String getComment() {
+    // return this.comment;
+    // }
+
+    // public void setComment(final String comment) {
+    // this.comment = comment;
+    // }
+
+    @OneToMany
+    @JoinColumn(name = "daily_discharge_id")
+    public List<DailyDischargeValue> getValues() {
+        return this.values;
+    }
+
+    public void setValues(final List<DailyDischargeValue> values) {
+        this.values = values;
+    }
+
+    public void addValue(final DailyDischargeValue value) {
+        this.values.add(value);
+    }
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org