changeset 5244:07671181414d

Remove hibernated and unhibernated Waterlevel*-model classes.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 12 Mar 2013 12:09:02 +0100
parents 2e519b08cff3
children 8959e1f8d297
files flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.java flys-backend/src/main/java/de/intevation/flys/model/WaterlevelValue.java
diffstat 6 files changed, 0 insertions(+), 508 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-package de.intevation.flys.importer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import de.intevation.flys.model.Waterlevel;
-
-import org.apache.log4j.Logger;
-
-
-/** Model-class in transition: no hibernated representative. */
-public class ImportWaterlevel {
-
-    private static final Logger log = Logger.getLogger(ImportWaterlevel.class);
-
-    private ImportUnit unit;
-
-    private String description;
-
-    private List<ImportWaterlevelQRange> qRanges;
-
-    private Waterlevel peer;
-
-    public ImportWaterlevel(String description) {
-        this.qRanges = new ArrayList<ImportWaterlevelQRange>();
-
-        this.description = description;
-    }
-
-    public String getDescription() {
-        return this.description;
-    }
-
-    public void setUnit(ImportUnit unit) {
-        this.unit = unit;
-    }
-
-    public ImportUnit getUnit() {
-        return this.unit;
-    }
-
-    public void addValue(ImportWaterlevelQRange qRange) {
-        this.qRanges.add(qRange);
-    }
-
-    public List<ImportWaterlevelQRange> getQRanges() {
-        return this.qRanges;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-package de.intevation.flys.importer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.hibernate.Session;
-import org.hibernate.Query;
-
-import de.intevation.flys.model.Waterlevel;
-import de.intevation.flys.model.WaterlevelQRange;
-
-
-/** Has a Q and list of W,km values. */
-public class ImportWaterlevelQRange {
-
-    private static final Logger log =
-        Logger.getLogger(ImportWaterlevelQRange.class);
-
-    private Double q;
-
-    private List<ImportWaterlevelValue> values;
-
-    private WaterlevelQRange peer;
-
-
-    public ImportWaterlevelQRange(Double q) {
-        this.values = new ArrayList<ImportWaterlevelValue>();
-        this.q      = q;
-    }
-
-    public void addValue(ImportWaterlevelValue value) {
-        this.values.add(value);
-    }
-
-    public Double getQ() {
-        return this.q;
-    }
-
-    public List<ImportWaterlevelValue> getValues() {
-        return values;
-    }
-
-    public void storeDependencies(Waterlevel waterlevel) {
-        log.info("store dependencies");
-
-        WaterlevelQRange peer = getPeer(waterlevel);
-
-        int i = 0;
-
-        for (ImportWaterlevelValue value: values) {
-            value.storeDependencies(peer);
-            i++;
-        }
-
-        log.info("stored " + i + " waterlevel values");
-    }
-
-
-    public WaterlevelQRange getPeer(Waterlevel waterlevel) {
-        if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query = session.createQuery(
-                "from WaterlevelQRange where " +
-                "   waterlevel=:waterlevel and " +
-                "   q=:q"
-            );
-
-            query.setParameter("waterlevel", waterlevel);
-            query.setParameter("q", q);
-
-            List<WaterlevelQRange> qRanges = query.list();
-            if (qRanges.isEmpty()) {
-                peer = new WaterlevelQRange(waterlevel, q);
-                session.save(peer);
-            }
-            else {
-                peer = qRanges.get(0);
-            }
-        }
-
-        return peer;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-package de.intevation.flys.importer;
-
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.Query;
-
-import de.intevation.flys.model.WaterlevelQRange;
-import de.intevation.flys.model.WaterlevelValue;
-
-
-/** W and a station. */
-public class ImportWaterlevelValue {
-
-    private Double station;
-    private Double w;
-
-    private WaterlevelValue peer;
-
-
-    public ImportWaterlevelValue(Double station, Double w) {
-        this.station = station;
-        this.w       = w;
-    }
-
-
-    public void storeDependencies(WaterlevelQRange qRange) {
-        getPeer(qRange);
-    }
-
-
-    public Double getStation() {
-        return this.station;
-    }
-
-
-    public Double getW() {
-        return this.w;
-    }
-
-    public WaterlevelValue getPeer(WaterlevelQRange qRange) {
-        if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query = session.createQuery(
-                "from WaterlevelValue where " +
-                "   qrange=:qrange and " +
-                "   station=:station and " +
-                "   w=:w"
-            );
-
-            query.setParameter("qrange", qRange);
-            query.setParameter("station", station);
-            query.setParameter("w", w);
-
-            List<WaterlevelValue> values = query.list();
-
-            if (values.isEmpty()) {
-                peer = new WaterlevelValue(qRange, station, w);
-                session.save(peer);
-            }
-            else {
-                peer = values.get(0);
-            }
-        }
-
-        return peer;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-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.GenerationType;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.OneToMany;
-
-import org.apache.log4j.Logger;
-
-
-
-/** Mapped Waterlevel. */
-@Entity
-@Table(name = "waterlevel")
-public class Waterlevel
-implements   Serializable
-{
-    private static Logger logger = Logger.getLogger(Waterlevel.class);
-
-    private Integer id;
-
-    private River river;
-
-    private Unit unit;
-
-    private String  description;
-
-    private List<WaterlevelQRange> qRanges;
-
-
-    public Waterlevel() {
-    }
-
-    public Waterlevel(River river, Unit unit) {
-        this.river = river;
-        this.unit  = unit;
-    }
-
-    public Waterlevel(River river, Unit unit, String description) {
-        this(river, unit);
-        this.description = description;
-    }
-
-    @Id
-    @SequenceGenerator(
-        name           = "SEQUENCE_WATERLEVEL_ID_SEQ",
-        sequenceName   = "WATERLEVEL_ID_SEQ",
-        allocationSize = 1)
-    @GeneratedValue(
-        strategy  = GenerationType.SEQUENCE,
-        generator = "SEQUENCE_WATERLEVEL_ID_SEQ")
-    @Column(name = "id")
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    @OneToOne
-    @JoinColumn(name = "river_id" )
-    public River getRiver() {
-        return river;
-    }
-
-    public void setRiver(River river) {
-        this.river = river;
-    }
-
-    @OneToOne
-    @JoinColumn(name = "unit_id")
-    public Unit getUnit() {
-        return unit;
-    }
-
-    public void setUnit(Unit unit) {
-        this.unit = unit;
-    }
-
-    @Column(name = "description")
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    @OneToMany
-    @JoinColumn(name="waterlevel_id")
-    public List<WaterlevelQRange> getQRanges() {
-        return qRanges;
-    }
-
-    public void setQRanges(List<WaterlevelQRange> qRanges) {
-        this.qRanges = qRanges;
-    }
-
-    public void addQRange(WaterlevelQRange qRange) {
-        qRanges.add(qRange);
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-package de.intevation.flys.model;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-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.GenerationType;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.OneToMany;
-
-import org.apache.log4j.Logger;
-
-
-
-
-@Entity
-@Table(name = "waterlevel_q_range")
-public class WaterlevelQRange
-implements   Serializable
-{
-    private static Logger logger = Logger.getLogger(WaterlevelQRange.class);
-
-    private Integer id;
-
-    private Waterlevel waterlevel;
-
-    private Double q;
-
-    private List<WaterlevelValue> values;
-
-
-    public WaterlevelQRange() {
-        this.values = new ArrayList<WaterlevelValue>();
-    }
-
-    public WaterlevelQRange(Waterlevel waterlevel, Double q) {
-        this();
-        this.q          = q;
-        this.waterlevel = waterlevel;
-    }
-
-
-    @Id
-    @SequenceGenerator(
-        name           = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ",
-        sequenceName   = "WATERLEVEL_Q_RANGES_ID_SEQ",
-        allocationSize = 1)
-    @GeneratedValue(
-        strategy  = GenerationType.SEQUENCE,
-        generator = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ")
-    @Column(name = "id")
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    @OneToOne
-    @JoinColumn(name = "waterlevel_id" )
-    public Waterlevel getWaterlevel() {
-        return waterlevel;
-    }
-
-    public void setWaterlevel(Waterlevel waterlevel) {
-        this.waterlevel = waterlevel;
-    }
-
-    @Column(name = "q")
-    public Double getQ() {
-        return q;
-    }
-
-    public void setQ(Double q) {
-        this.q = q;
-    }
-
-    @OneToMany
-    @Column(name = "waterlevel_q_range_id")
-    public List<WaterlevelValue> getValues() {
-        return values;
-    }
-
-    public void setValues(List<WaterlevelValue> values) {
-        this.values = values;
-    }
-
-    public void addValue(WaterlevelValue value) {
-        values.add(value);
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelValue.java	Tue Mar 12 11:32:42 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-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.GenerationType;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-
-import org.apache.log4j.Logger;
-
-
-
-
-@Entity
-@Table(name = "waterlevel_values")
-public class WaterlevelValue
-implements   Serializable
-{
-    private static Logger logger = Logger.getLogger(WaterlevelValue.class);
-
-    private Integer id;
-
-    private WaterlevelQRange qrange;
-
-    private Double station;
-    private Double w;
-
-
-    public WaterlevelValue() {
-    }
-
-    public WaterlevelValue(WaterlevelQRange qrange, Double station, Double w) {
-        this.qrange  = qrange;
-        this.station = station;
-        this.w       = w;
-    }
-
-
-    @Id
-    @SequenceGenerator(
-        name           = "SEQUENCE_WATERLEVEL_VALUES_ID_SEQ",
-        sequenceName   = "WATERLEVEL_VALUES_ID_SEQ",
-        allocationSize = 1)
-    @GeneratedValue(
-        strategy  = GenerationType.SEQUENCE,
-        generator = "SEQUENCE_WATERLEVEL_VALUES_ID_SEQ")
-    @Column(name = "id")
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    @OneToOne
-    @JoinColumn(name = "waterlevel_q_range_id" )
-    public WaterlevelQRange getQrange() {
-        return qrange;
-    }
-
-    public void setQrange(WaterlevelQRange qrange) {
-        this.qrange = qrange;
-    }
-
-    @Column(name = "station")
-    public Double getStation() {
-        return station;
-    }
-
-    public void setStation(Double station) {
-        this.station = station;
-    }
-
-    @Column(name = "w")
-    public Double getW() {
-        return w;
-    }
-
-    public void setW(Double w) {
-        this.w = w;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org