comparison flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityMeasurement.java @ 2830:6faa47ca1fee

Added new model classes for storing flow velocity measurements. flys-backend/trunk@4248 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 17 Apr 2012 11:58:43 +0000
parents
children cc6323401643
comparison
equal deleted inserted replaced
2829:4074777afcfa 2830:6faa47ca1fee
1 package de.intevation.flys.model;
2
3 import java.io.Serializable;
4 import java.util.List;
5
6 import javax.persistence.Entity;
7 import javax.persistence.Id;
8 import javax.persistence.Table;
9 import javax.persistence.GeneratedValue;
10 import javax.persistence.Column;
11 import javax.persistence.SequenceGenerator;
12 import javax.persistence.GenerationType;
13 import javax.persistence.JoinColumn;
14 import javax.persistence.OneToOne;
15 import javax.persistence.OneToMany;
16
17 import org.apache.log4j.Logger;
18
19
20 @Entity
21 @Table(name = "flow_velocity_measurements")
22 public class FlowVelocityMeasurement
23 implements Serializable
24 {
25 private static Logger logger =
26 Logger.getLogger(FlowVelocityMeasurement.class);
27
28
29 private Integer id;
30
31 private River river;
32
33 private String description;
34
35 private List<FlowVelocityMeasurementValue> values;
36
37
38 public FlowVelocityMeasurement() {
39 }
40
41
42 public FlowVelocityMeasurement(River river, String description) {
43 this.river = river;
44 this.description = description;
45 }
46
47 @Id
48 @SequenceGenerator(
49 name = "SEQUENCE_FV_MEASURE_ID_SEQ",
50 sequenceName = "FV_MEASURE_ID_SEQ",
51 allocationSize = 1)
52 @GeneratedValue(
53 strategy = GenerationType.SEQUENCE,
54 generator = "SEQUENCE_FV_MEASURE_ID_SEQ")
55 @Column(name = "id")
56 public Integer getId() {
57 return id;
58 }
59
60 public void setId(Integer id) {
61 this.id = id;
62 }
63
64 @OneToOne
65 @JoinColumn(name = "river_id" )
66 public River getRiver() {
67 return river;
68 }
69
70 public void setRiver(River river) {
71 this.river = river;
72 }
73
74 @Column(name = "description")
75 public String getDescription() {
76 return description;
77 }
78
79 public void setDescription(String description) {
80 this.description = description;
81 }
82
83 @OneToMany
84 @JoinColumn(name = "measurements_id")
85 public List<FlowVelocityMeasurementValue> getValues() {
86 return values;
87 }
88
89 public void setValues(List<FlowVelocityMeasurementValue> values) {
90 this.values = values;
91 }
92
93 public void addValue(FlowVelocityMeasurementValue value) {
94 this.values.add(value);
95 }
96 }
97 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org