[Dive4elements-commits] [PATCH] Remove hibernated and unhibernated Waterlevel*-model classes
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 12 12:02:39 CET 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1363086542 -3600
# Node ID 07671181414d3d3a3f78d7917b0d00b795776867
# Parent 2e519b08cff348975b769357b03f0949d5f2509a
Remove hibernated and unhibernated Waterlevel*-model classes.
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java
--- 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 :
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java
--- 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 :
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java
--- 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 :
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java
--- 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. */
- at Entity
- at 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 :
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.java
--- 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;
-
-
-
-
- at Entity
- at 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 :
diff -r 2e519b08cff3 -r 07671181414d flys-backend/src/main/java/de/intevation/flys/model/WaterlevelValue.java
--- 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;
-
-
-
-
- at Entity
- at 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 :
More information about the Dive4elements-commits
mailing list