ingo@2842: package de.intevation.flys.model; ingo@2842: ingo@2842: import java.io.Serializable; ingo@2842: import java.util.List; ingo@2842: ingo@2842: import javax.persistence.Entity; ingo@2842: import javax.persistence.Id; ingo@2842: import javax.persistence.Table; ingo@2842: import javax.persistence.GeneratedValue; ingo@2842: import javax.persistence.Column; ingo@2842: import javax.persistence.SequenceGenerator; ingo@2842: import javax.persistence.GenerationType; ingo@2842: import javax.persistence.JoinColumn; ingo@2842: import javax.persistence.OneToOne; ingo@2842: import javax.persistence.OneToMany; ingo@2842: ingo@2842: import org.apache.log4j.Logger; ingo@2842: ingo@2842: ingo@2842: ingo@2842: ingo@2842: @Entity ingo@2842: @Table(name = "waterlevel") ingo@2842: public class Waterlevel ingo@2842: implements Serializable ingo@2842: { ingo@2842: private static Logger logger = Logger.getLogger(Waterlevel.class); ingo@2842: ingo@2842: private Integer id; ingo@2842: ingo@2842: private River river; ingo@2842: ingo@2842: private Unit unit; ingo@2842: ingo@2842: private String description; ingo@2842: ingo@2842: private List qRanges; ingo@2842: ingo@2842: ingo@2842: public Waterlevel() { ingo@2842: } ingo@2842: ingo@2842: public Waterlevel(River river, Unit unit) { ingo@2842: this.river = river; ingo@2842: this.unit = unit; ingo@2842: } ingo@2842: ingo@2842: public Waterlevel(River river, Unit unit, String description) { ingo@2842: this(river, unit); ingo@2842: this.description = description; ingo@2842: } ingo@2842: ingo@2842: @Id ingo@2842: @SequenceGenerator( ingo@2842: name = "SEQUENCE_WATERLEVEL_ID_SEQ", ingo@2842: sequenceName = "WATERLEVEL_ID_SEQ", ingo@2842: allocationSize = 1) ingo@2842: @GeneratedValue( ingo@2842: strategy = GenerationType.SEQUENCE, ingo@2842: generator = "SEQUENCE_WATERLEVEL_ID_SEQ") ingo@2842: @Column(name = "id") ingo@2842: public Integer getId() { ingo@2842: return id; ingo@2842: } ingo@2842: ingo@2842: public void setId(Integer id) { ingo@2842: this.id = id; ingo@2842: } ingo@2842: ingo@2842: @OneToOne ingo@2842: @JoinColumn(name = "river_id" ) ingo@2842: public River getRiver() { ingo@2842: return river; ingo@2842: } ingo@2842: ingo@2842: public void setRiver(River river) { ingo@2842: this.river = river; ingo@2842: } ingo@2842: ingo@2842: @OneToOne ingo@2842: @JoinColumn(name = "unit_id") ingo@2842: public Unit getUnit() { ingo@2842: return unit; ingo@2842: } ingo@2842: ingo@2842: public void setUnit(Unit unit) { ingo@2842: this.unit = unit; ingo@2842: } ingo@2842: ingo@2842: @Column(name = "description") ingo@2842: public String getDescription() { ingo@2842: return description; ingo@2842: } ingo@2842: ingo@2842: public void setDescription(String description) { ingo@2842: this.description = description; ingo@2842: } ingo@2842: ingo@2842: @OneToMany ingo@2842: @JoinColumn(name="waterlevel_id") ingo@2842: public List getQRanges() { ingo@2842: return qRanges; ingo@2842: } ingo@2842: ingo@2842: public void setQRanges(List qRanges) { ingo@2842: this.qRanges = qRanges; ingo@2842: } ingo@2842: ingo@2842: public void addQRange(WaterlevelQRange qRange) { ingo@2842: qRanges.add(qRange); ingo@2842: } ingo@2842: } ingo@2842: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :