sascha@1194: package de.intevation.flys.model;
sascha@1194: 
sascha@1194: import java.io.Serializable;
sascha@1194: 
sascha@1194: import java.util.List;
sascha@1194: 
sascha@1194: import javax.persistence.Entity;
sascha@1194: import javax.persistence.Id;
sascha@1194: import javax.persistence.Table;
sascha@1194: import javax.persistence.GeneratedValue;
sascha@1194: import javax.persistence.Column;
sascha@1194: import javax.persistence.SequenceGenerator;
sascha@1194: import javax.persistence.GenerationType;
sascha@1194: import javax.persistence.OneToOne;
sascha@1194: import javax.persistence.OneToMany;
sascha@1210: import javax.persistence.OrderBy;
sascha@1194: import javax.persistence.JoinColumn;
sascha@1194: 
sascha@1194: @Entity
sascha@1194: @Table(name = "cross_sections")
sascha@1194: public class CrossSection
sascha@1194: implements   Serializable
sascha@1194: {
sascha@1203:     private Integer                id;
sascha@1203:     private River                  river;
sascha@1203:     private TimeInterval           timeInterval;
sascha@1203:     private String                 description;
sascha@1203:     private List<CrossSectionLine> lines;
sascha@1194: 
sascha@1194:     public CrossSection() {
sascha@1194:     }
sascha@1194: 
sascha@1204:     public CrossSection(
sascha@1204:         River        river,
sascha@1204:         TimeInterval timeInterval,
sascha@1204:         String       description
sascha@1204:     ) {
sascha@1204:         this.river        = river;
sascha@1204:         this.timeInterval = timeInterval;
sascha@1204:         this.description  = description;
sascha@1204:     }
sascha@1204: 
sascha@1194:     @Id
sascha@1194:     @SequenceGenerator(
sascha@1194:         name           = "SEQUENCE_CROSS_SECTIONS_ID_SEQ",
sascha@1194:         sequenceName   = "CROSS_SECTIONS_ID_SEQ",
sascha@1194:         allocationSize = 1)
sascha@1194:     @GeneratedValue(
sascha@1194:         strategy  = GenerationType.SEQUENCE,
sascha@1194:         generator = "SEQUENCE_CROSS_SECTIONS_ID_SEQ")
sascha@1194:     @Column(name = "id")
sascha@1194:     public Integer getId() {
sascha@1194:         return id;
sascha@1194:     }
sascha@1194: 
sascha@1194:     public void setId(Integer id) {
sascha@1194:         this.id = id;
sascha@1194:     }
sascha@1194: 
sascha@1194:     @OneToOne
sascha@1194:     @JoinColumn(name = "river_id")
sascha@1194:     public River getRiver() {
sascha@1194:         return river;
sascha@1194:     }
sascha@1194: 
sascha@1194:     public void setRiver(River river) {
sascha@1194:         this.river = river;
sascha@1194:     }
sascha@1194: 
sascha@1194:     @OneToOne
sascha@1194:     @JoinColumn(name = "time_interval_id")
sascha@1194:     public TimeInterval getTimeInterval() {
sascha@1194:         return timeInterval;
sascha@1194:     }
sascha@1194: 
sascha@1194:     public void setTimeInterval(TimeInterval timeInterval) {
sascha@1194:         this.timeInterval = timeInterval;
sascha@1194:     }
sascha@1194: 
sascha@1202:     @Column(name = "description")
sascha@1202:     public String getDescription() {
sascha@1202:         return description;
sascha@1202:     }
sascha@1202: 
sascha@1202:     public void setDescription(String description) {
sascha@1202:         this.description = description;
sascha@1202:     }
sascha@1202: 
sascha@1194:     @OneToMany
sascha@1210:     @OrderBy("km")
sascha@1194:     @JoinColumn(name="cross_section_id")
sascha@1203:     public List<CrossSectionLine> getLines() {
sascha@1203:         return lines;
sascha@1194:     }
sascha@1194: 
sascha@1203:     public void setLines(List<CrossSectionLine> lines) {
sascha@1203:         this.lines = lines;
sascha@1194:     }
sascha@1194: }
sascha@1194: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :