ingo@2812: package de.intevation.flys.model;
ingo@2812: 
ingo@2812: import java.io.Serializable;
ingo@2812: import java.util.List;
ingo@2812: 
ingo@2812: import javax.persistence.Entity;
ingo@2812: import javax.persistence.Id;
ingo@2812: import javax.persistence.Table;
ingo@2812: import javax.persistence.GeneratedValue;
ingo@2812: import javax.persistence.Column;
ingo@2812: import javax.persistence.SequenceGenerator;
ingo@2812: import javax.persistence.GenerationType;
ingo@2812: import javax.persistence.JoinColumn;
ingo@2812: import javax.persistence.OneToOne;
ingo@2812: import javax.persistence.OneToMany;
ingo@2812: 
ingo@2812: 
ingo@2812: @Entity
ingo@2812: @Table(name = "sediment_density")
ingo@2812: public class SedimentDensity implements Serializable {
ingo@2812: 
ingo@2812:     private Integer id;
ingo@2812: 
ingo@2812:     private River river;
ingo@2812: 
ingo@2812:     private Depth depth;
ingo@2812: 
ingo@2817:     private Unit unit;
ingo@2817: 
ingo@2812:     private List<SedimentDensityValue> values;
ingo@2812: 
ingo@2817:     private String description;
ingo@2817: 
ingo@2812: 
ingo@2812:     public SedimentDensity() {
ingo@2812:     }
ingo@2812: 
ingo@2812: 
ingo@2817:     public SedimentDensity(River river, Depth depth, Unit unit, String desc) {
ingo@2817:         this.river       = river;
ingo@2817:         this.depth       = depth;
ingo@2817:         this.unit        = unit;
ingo@2817:         this.description = desc;
ingo@2812:     }
ingo@2812: 
ingo@2812:     @Id
ingo@2812:     @SequenceGenerator(
ingo@2812:         name           = "SEQUENCE_SEDIMENT_DENSITY_ID_SEQ",
ingo@2812:         sequenceName   = "SEDIMENT_DENSITY_ID_SEQ",
ingo@2812:         allocationSize = 1)
ingo@2812:     @GeneratedValue(
ingo@2812:         strategy  = GenerationType.SEQUENCE,
ingo@2812:         generator = "SEQUENCE_SEDIMENT_DENSITY_ID_SEQ")
ingo@2812:     @Column(name = "id")
ingo@2812:     public Integer getId() {
ingo@2812:         return id;
ingo@2812:     }
ingo@2812: 
ingo@2812:     public void setId(Integer id) {
ingo@2812:         this.id = id;
ingo@2812:     }
ingo@2812: 
ingo@2812:     @OneToOne
ingo@2812:     @JoinColumn(name = "river_id" )
ingo@2812:     public River getRiver() {
ingo@2812:         return river;
ingo@2812:     }
ingo@2812: 
ingo@2812:     public void setRiver(River river) {
ingo@2812:         this.river = river;
ingo@2812:     }
ingo@2812: 
ingo@2812:     @OneToOne
ingo@2812:     @JoinColumn(name = "depth_id")
ingo@2812:     public Depth getDepth() {
ingo@2812:         return depth;
ingo@2812:     }
ingo@2812: 
ingo@2812:     public void setDepth(Depth depth) {
ingo@2812:         this.depth = depth;
ingo@2812:     }
ingo@2812: 
ingo@2817:     @OneToOne
ingo@2817:     @JoinColumn(name = "unit_id")
ingo@2817:     public Unit getUnit() {
ingo@2817:         return unit;
ingo@2817:     }
ingo@2817: 
ingo@2817:     public void setUnit(Unit unit) {
ingo@2817:         this.unit = unit;
ingo@2817:     }
ingo@2817: 
ingo@2817:     @Column(name = "description")
ingo@2817:     public String getDescription() {
ingo@2817:         return description;
ingo@2817:     }
ingo@2817: 
ingo@2817:     public void setDescription(String description) {
ingo@2817:         this.description = description;
ingo@2817:     }
ingo@2817: 
ingo@2812:     @OneToMany
ingo@2812:     @JoinColumn(name="sediment_density_id")
ingo@2812:     public List<SedimentDensityValue> getValues() {
ingo@2812:         return values;
ingo@2812:     }
ingo@2812: 
ingo@2817:     public void setValues(List<SedimentDensityValue> values) {
ingo@2817:         this.values = values;
ingo@2817:     }
ingo@2817: 
ingo@2812:     public void addValue(SedimentDensityValue value) {
ingo@2812:         this.values.add(value);
ingo@2812:     }
ingo@2812: }
ingo@2812: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :