sascha@189: package de.intevation.flys.model; sascha@189: sascha@189: import java.io.Serializable; sascha@189: sascha@189: import javax.persistence.Entity; sascha@189: import javax.persistence.Id; sascha@189: import javax.persistence.Table; sascha@189: import javax.persistence.GeneratedValue; sascha@189: import javax.persistence.Column; sascha@189: import javax.persistence.SequenceGenerator; sascha@189: import javax.persistence.OneToOne; sascha@189: import javax.persistence.JoinColumn; sascha@189: import javax.persistence.GenerationType; sascha@189: sascha@189: import java.math.BigDecimal; sascha@189: felix@5375: felix@5375: /** A Main or Extreme value of a rivers gauge. */ sascha@189: @Entity sascha@189: @Table(name = "main_values") sascha@189: public class MainValue sascha@189: implements Serializable sascha@189: { sascha@189: private Integer id; sascha@189: sascha@189: private Gauge gauge; sascha@189: sascha@189: private NamedMainValue mainValue; sascha@189: sascha@189: private BigDecimal value; sascha@189: sascha@189: private TimeInterval timeInterval; sascha@189: sascha@189: public MainValue() { sascha@189: } sascha@189: sascha@195: public MainValue( sascha@195: Gauge gauge, sascha@195: NamedMainValue mainValue, sascha@195: BigDecimal value, sascha@195: TimeInterval timeInterval sascha@195: ) { sascha@195: this.gauge = gauge; sascha@195: this.mainValue = mainValue; sascha@195: this.value = value; sascha@195: this.timeInterval = timeInterval; sascha@195: } sascha@195: sascha@189: @Id sascha@189: @SequenceGenerator( sascha@189: name = "SEQUENCE_MAIN_VALUES_ID_SEQ", sascha@189: sequenceName = "MAIN_VALUES_ID_SEQ", sascha@189: allocationSize = 1) sascha@189: @GeneratedValue( sascha@189: strategy = GenerationType.SEQUENCE, sascha@189: generator = "SEQUENCE_MAIN_VALUES_ID_SEQ") sascha@189: @Column(name = "id") sascha@189: public Integer getId() { sascha@189: return id; sascha@189: } sascha@189: sascha@189: public void setId(Integer id) { sascha@189: this.id = id; sascha@189: } sascha@189: sascha@189: @OneToOne sascha@189: @JoinColumn(name = "gauge_id") sascha@189: public Gauge getGauge() { sascha@189: return gauge; sascha@189: } sascha@189: sascha@189: public void setGauge(Gauge gauge) { sascha@189: this.gauge = gauge; sascha@189: } sascha@189: sascha@189: @OneToOne sascha@189: @JoinColumn(name = "named_value_id") sascha@189: public NamedMainValue getMainValue() { sascha@189: return mainValue; sascha@189: } sascha@189: sascha@189: public void setMainValue(NamedMainValue mainValue) { sascha@189: this.mainValue = mainValue; sascha@189: } sascha@189: sascha@189: @Column(name = "value") // FIXME: type mapping needed? sascha@189: public BigDecimal getValue() { sascha@189: return value; sascha@189: } sascha@189: sascha@189: public void setValue(BigDecimal value) { sascha@189: this.value = value; sascha@189: } sascha@189: sascha@189: @OneToOne sascha@189: @JoinColumn(name = "time_interval_id") sascha@189: public TimeInterval getTimeInterval() { sascha@189: return timeInterval; sascha@189: } sascha@189: sascha@189: public void setTimeInterval(TimeInterval timeInterval) { sascha@189: this.timeInterval = timeInterval; sascha@189: } sascha@189: } sascha@189: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :