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_column") ingo@2847: public class WaterlevelDifferenceColumn ingo@2847: implements Serializable ingo@2847: { ingo@2847: private static Logger logger = ingo@2847: Logger.getLogger(WaterlevelDifferenceColumn.class); ingo@2847: ingo@2847: ingo@2847: private Integer id; ingo@2847: ingo@2847: private WaterlevelDifference difference; ingo@2847: ingo@2847: private List values; ingo@2847: ingo@2847: private String description; ingo@2847: ingo@2847: ingo@2847: public WaterlevelDifferenceColumn() { ingo@2847: values = new ArrayList(); ingo@2847: } ingo@2847: ingo@2847: public WaterlevelDifferenceColumn( ingo@2847: WaterlevelDifference difference, ingo@2847: String description ingo@2847: ) { ingo@2847: this(); ingo@2847: ingo@2847: this.difference = difference; ingo@2847: this.description = description; ingo@2847: } ingo@2847: ingo@2847: ingo@2847: @Id ingo@2847: @SequenceGenerator( ingo@2847: name = "SEQUENCE_WATERLEVEL_DIFF_COLUMN_ID_SEQ", ingo@2847: sequenceName = "WATERLEVEL_DIFF_COLUMN_ID_SEQ", ingo@2847: allocationSize = 1) ingo@2847: @GeneratedValue( ingo@2847: strategy = GenerationType.SEQUENCE, ingo@2847: generator = "SEQUENCE_WATERLEVEL_DIFF_COLUMN_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 = "difference_id" ) ingo@2847: public WaterlevelDifference getDifference() { ingo@2847: return difference; ingo@2847: } ingo@2847: ingo@2847: public void setDifference(WaterlevelDifference difference) { ingo@2847: this.difference = difference; 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 = "column_id") ingo@2847: public List getValues() { ingo@2847: return values; ingo@2847: } ingo@2847: ingo@2847: public void setValues(List values) { ingo@2847: this.values = values; ingo@2847: } ingo@2847: ingo@2847: public void addValue(WaterlevelDifferenceValue value) { ingo@2847: this.values.add(value); ingo@2847: } ingo@2847: } ingo@2847: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :