ingo@2847: package de.intevation.flys.model; ingo@2847: ingo@2847: import java.io.Serializable; ingo@2847: import java.util.ArrayList; ingo@2847: import java.util.List; ingo@2847: ingo@2847: import javax.persistence.Entity; ingo@2847: import javax.persistence.Id; ingo@2847: import javax.persistence.Table; ingo@2847: import javax.persistence.GeneratedValue; ingo@2847: import javax.persistence.Column; ingo@2847: import javax.persistence.SequenceGenerator; ingo@2847: import javax.persistence.GenerationType; ingo@2847: import javax.persistence.JoinColumn; ingo@2847: import javax.persistence.OneToOne; ingo@2847: import javax.persistence.OneToMany; ingo@2847: ingo@2847: import org.apache.log4j.Logger; ingo@2847: ingo@2847: ingo@2847: @Entity ingo@2847: @Table(name = "waterlevel_difference") ingo@2847: public class WaterlevelDifference ingo@2847: implements Serializable ingo@2847: { ingo@2847: private static Logger logger = Logger.getLogger(WaterlevelDifference.class); ingo@2847: ingo@2847: private Integer id; ingo@2847: ingo@2847: private River river; ingo@2847: ingo@2847: private Unit unit; ingo@2847: ingo@2847: private List columns; ingo@2847: ingo@2847: private String description; ingo@2847: ingo@2847: ingo@2847: public WaterlevelDifference() { ingo@2847: columns = new ArrayList(); ingo@2847: } ingo@2847: ingo@2847: ingo@2847: public WaterlevelDifference(River river, Unit unit) { ingo@2847: this(); ingo@2847: ingo@2847: this.river = river; ingo@2847: this.unit = unit; ingo@2847: } ingo@2847: ingo@2847: ingo@2847: public WaterlevelDifference(River river, Unit unit, String description) { ingo@2847: this(river, unit); ingo@2847: ingo@2847: this.description = description; ingo@2847: } ingo@2847: ingo@2847: ingo@2847: @Id ingo@2847: @SequenceGenerator( ingo@2847: name = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ", ingo@2847: sequenceName = "WATERLEVEL_DIFFERENCE_ID_SEQ", ingo@2847: allocationSize = 1) ingo@2847: @GeneratedValue( ingo@2847: strategy = GenerationType.SEQUENCE, ingo@2847: generator = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ") ingo@2847: @Column(name = "id") ingo@2847: public Integer getId() { ingo@2847: return id; ingo@2847: } ingo@2847: ingo@2847: public void setId(Integer id) { ingo@2847: this.id = id; ingo@2847: } ingo@2847: ingo@2847: @OneToOne ingo@2847: @JoinColumn(name = "river_id" ) ingo@2847: public River getRiver() { ingo@2847: return river; ingo@2847: } ingo@2847: ingo@2847: public void setRiver(River river) { ingo@2847: this.river = river; ingo@2847: } ingo@2847: ingo@2847: @OneToOne ingo@2847: @JoinColumn(name = "unit_id") ingo@2847: public Unit getUnit() { ingo@2847: return unit; ingo@2847: } ingo@2847: ingo@2847: public void setUnit(Unit unit) { ingo@2847: this.unit = unit; ingo@2847: } ingo@2847: ingo@2847: @Column(name = "description") ingo@2847: public String getDescription() { ingo@2847: return description; ingo@2847: } ingo@2847: ingo@2847: public void setDescription(String description) { ingo@2847: this.description = description; ingo@2847: } ingo@2847: ingo@2847: @OneToMany ingo@2847: @JoinColumn(name = "difference_id") ingo@2847: public List getColumns() { ingo@2847: return columns; ingo@2847: } ingo@2847: ingo@2847: public void setColumns(List columns) { ingo@2847: this.columns = columns; ingo@2847: } ingo@2847: ingo@2847: public void addColumn(WaterlevelDifferenceColumn column) { ingo@2847: this.columns.add(column); ingo@2847: } ingo@2847: } ingo@2847: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :