Mercurial > dive4elements > river
view backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java @ 8955:798d9dcbccdd
BedHeightValue (bed_height_values) extended by two columns for minimum and maximum bed height
author | mschaefer |
---|---|
date | Mon, 19 Mar 2018 16:32:42 +0100 |
parents | ff27548d078c |
children | a0a0a7f912ab |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * 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; import java.util.List; 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; import org.hibernate.Session; import org.hibernate.Query; import org.dive4elements.river.backend.SessionHolder; @Entity @Table(name = "bed_height_values") public class BedHeightValue implements Serializable { private static Logger log = Logger.getLogger(BedHeightValue.class); private Integer id; private BedHeight bedHeight; private Double station; private Double height; private Double uncertainty; private Double dataGap; private Double soundingWidth; private Double minHeight; private Double maxHeight; public BedHeightValue() { } public BedHeightValue(final BedHeight bedHeight, final Double station, final Double height, final Double uncertainty, final Double dataGap, final Double soundingWidth, final Double minHeight, final Double maxHeight) { this.bedHeight = bedHeight; this.station = station; this.height = height; this.uncertainty = uncertainty; this.dataGap = dataGap; this.soundingWidth = soundingWidth; this.minHeight = minHeight; this.maxHeight = maxHeight; } @Id @SequenceGenerator(name = "SEQUENCE_BED_HEIGHT_VALUE_ID_SEQ", sequenceName = "BED_HEIGHT_VALUES_ID_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE_BED_HEIGHT_VALUE_ID_SEQ") @Column(name = "id") public Integer getId() { return this.id; } public void setId(final Integer id) { this.id = id; } @OneToOne @JoinColumn(name = "bed_height_id") public BedHeight getBedHeight() { return this.bedHeight; } public void setBedHeight(final BedHeight bedHeight) { this.bedHeight = bedHeight; } @Column(name = "station") public Double getStation() { return this.station; } public void setStation(final Double station) { this.station = station; } @Column(name = "height") public Double getHeight() { return this.height; } public void setHeight(final Double height) { this.height = height; } @Column(name="uncertainty") public Double getUncertainty() { return this.uncertainty; } public void setUncertainty(final Double uncertainty) { this.uncertainty = uncertainty; } @Column(name="data_gap") public Double getDataGap() { return this.dataGap; } public void setDataGap(final Double dataGap) { this.dataGap = dataGap; } @Column(name="sounding_width") public Double getSoundingWidth() { return this.soundingWidth; } public void setSoundingWidth(final Double soundingWidth) { this.soundingWidth = soundingWidth; } @Column(name = "min_height") public Double getMinHeight() { return this.minHeight; } public void setMinHeight(final Double minHeight) { this.minHeight = minHeight; } @Column(name = "max_height") public Double getMaxHeight() { return this.maxHeight; } public void setMaxHeight(final Double maxHeight) { this.maxHeight = maxHeight; } public static List<BedHeightValue> getBedHeightValues( BedHeight single) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( "from BedHeightValue where bedHeight=:single"); query.setParameter("single", single); return query.list(); } public static List<BedHeightValue> getBedHeightValues( BedHeight single, double kmLo, double kmHi ) { Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( "from BedHeightValue where bedHeight=:single " + " and station >= :kmLo and station <= :kmHi"); query.setParameter("single", single); query.setParameter("kmLo", new Double(kmLo)); query.setParameter("kmHi", new Double(kmHi)); return query.list(); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :