ingo@2830: package de.intevation.flys.model;
ingo@2830: 
ingo@2830: import java.io.Serializable;
ingo@2830: import java.math.BigDecimal;
ingo@2830: import java.util.Date;
ingo@2830: 
ingo@2830: import javax.persistence.Entity;
ingo@2830: import javax.persistence.Id;
ingo@2830: import javax.persistence.Table;
ingo@2830: import javax.persistence.GeneratedValue;
ingo@2830: import javax.persistence.Column;
ingo@2830: import javax.persistence.SequenceGenerator;
ingo@2830: import javax.persistence.GenerationType;
ingo@2830: import javax.persistence.JoinColumn;
ingo@2830: import javax.persistence.OneToOne;
ingo@2830: 
ingo@2830: import org.apache.log4j.Logger;
ingo@2830: 
ingo@2830: 
felix@4462: /** Measured Flow Velocities. */
ingo@2830: @Entity
ingo@2830: @Table(name = "flow_velocity_measure_values")
ingo@2830: public class FlowVelocityMeasurementValue
ingo@2830: implements   Serializable
ingo@2830: {
ingo@2830:     private static Logger logger =
ingo@2830:         Logger.getLogger(FlowVelocityMeasurementValue.class);
ingo@2830: 
ingo@2830:     private Integer id;
ingo@2830: 
ingo@2830:     private FlowVelocityMeasurement measurement;
ingo@2830: 
ingo@2830:     private BigDecimal station;
ingo@2830:     private BigDecimal w;
ingo@2830:     private BigDecimal q;
ingo@2830:     private BigDecimal v;
ingo@2830: 
ingo@2830:     private Date datetime;
ingo@2830: 
ingo@2830:     private String description;
ingo@2830: 
felix@4462:     /** Non-mapped class holding same values. */
felix@4462:     public static class FastFlowVelocityMeasurementValue {
felix@4462:         protected double station;
felix@4462:         protected double w;
felix@4462:         protected double q;
felix@4462:         protected double v;
felix@4462:         protected Date   datetime;
felix@4462:         protected String description;
felix@4462: 
felix@4462:         public FastFlowVelocityMeasurementValue(double station,
felix@4462:             double w, double q, double v, Date datetime, String description) {
felix@4462:             this.station = station;
felix@4462:             this.w       = w;
felix@4462:             this.q       = q;
felix@4462:             this.v       = v;
felix@4462:             this.datetime = datetime;
felix@4462:             this.description = description;
felix@4462:         }
felix@4462: 
felix@4462:         public double getStation() {
felix@4462:             return station;
felix@4462:         }
felix@4462: 
felix@4462:         public double getW() {
felix@4462:             return w;
felix@4462:         }
felix@4462: 
felix@4462:         public double getQ() {
felix@4462:             return q;
felix@4462:         }
felix@4462: 
felix@4462:         public double getV() {
felix@4462:             return v;
felix@4462:         }
felix@4462: 
felix@4462:         public Date getDatetime() {
felix@4462:             return datetime;
felix@4462:         }
felix@4462: 
felix@4462:         public String getDescription() {
felix@4462:             return description;
felix@4462:         }
felix@4462:     }
felix@4462: 
ingo@2830: 
ingo@2830:     public FlowVelocityMeasurementValue() {
ingo@2830:     }
ingo@2830: 
ingo@2830: 
ingo@2830:     public FlowVelocityMeasurementValue(
ingo@2830:         FlowVelocityMeasurement measurement,
ingo@2830:         Date                    datetime,
ingo@2830:         BigDecimal              station,
ingo@2830:         BigDecimal              w,
ingo@2830:         BigDecimal              q,
ingo@2830:         BigDecimal              v,
ingo@2830:         String                  description
ingo@2830:     ) {
ingo@2830:         this.measurement = measurement;
ingo@2830:         this.datetime    = datetime;
ingo@2830:         this.station     = station;
ingo@2830:         this.w           = w;
ingo@2830:         this.q           = q;
ingo@2830:         this.v           = v;
ingo@2830:         this.description = description;
ingo@2830:     }
ingo@2830: 
felix@4462:     public static FastFlowVelocityMeasurementValue getUnmapped(
felix@4462:             double station, double w, double q, double v, Date datetime, String description) {
felix@4462:          return new FastFlowVelocityMeasurementValue(
felix@4462:              station, w, q, v, datetime, description);
felix@4462:     }
felix@4462: 
ingo@2830:     @Id
ingo@2830:     @SequenceGenerator(
ingo@2830:         name           = "SEQUENCE_FV_MEASURE_VALUES_ID_SEQ",
ingo@2830:         sequenceName   = "FV_MEASURE_VALUES_ID_SEQ",
ingo@2830:         allocationSize = 1)
ingo@2830:     @GeneratedValue(
ingo@2830:         strategy  = GenerationType.SEQUENCE,
ingo@2830:         generator = "SEQUENCE_FV_MEASURE_VALUES_ID_SEQ")
ingo@2830:     @Column(name = "id")
ingo@2830:     public Integer getId() {
ingo@2830:         return id;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setId(Integer id) {
ingo@2830:         this.id = id;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @OneToOne
ingo@2830:     @JoinColumn(name = "measurements_id")
ingo@2830:     public FlowVelocityMeasurement getMeasurement() {
ingo@2830:         return measurement;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setMeasurement(FlowVelocityMeasurement measurement) {
ingo@2830:         this.measurement = measurement;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "station")
ingo@2830:     public BigDecimal getStation() {
ingo@2830:         return station;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setStation(BigDecimal station) {
ingo@2830:         this.station = station;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "datetime")
ingo@2830:     public Date getDatetime() {
ingo@2830:         return datetime;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setDatetime(Date datetime) {
ingo@2830:         this.datetime = datetime;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "w")
ingo@2830:     public BigDecimal getW() {
ingo@2830:         return w;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setW(BigDecimal w) {
ingo@2830:         this.w = w;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "q")
ingo@2830:     public BigDecimal getQ() {
ingo@2830:         return q;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setQ(BigDecimal q) {
ingo@2830:         this.q = q;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "v")
ingo@2830:     public BigDecimal getV() {
ingo@2830:         return v;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setV(BigDecimal v) {
ingo@2830:         this.v = v;
ingo@2830:     }
ingo@2830: 
ingo@2830:     @Column(name = "description")
ingo@2830:     public String getDescription() {
ingo@2830:         return description;
ingo@2830:     }
ingo@2830: 
ingo@2830:     public void setDescription(String description) {
ingo@2830:         this.description = description;
ingo@2830:     }
ingo@2830: }
ingo@2830: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :