annotate flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java @ 4193:f63b39799d2d

Adapted DB schema (added relation measurement_station); improved importer to read files from filesystem with measurement stations.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 22 Oct 2012 09:02:26 +0200
parents 71175502d868
children 7aeb2c101628
rev   line source
2837
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import javax.persistence.Entity;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import javax.persistence.Id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.persistence.Table;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.persistence.GeneratedValue;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.persistence.Column;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import javax.persistence.SequenceGenerator;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.persistence.GenerationType;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import javax.persistence.JoinColumn;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.OneToOne;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 @Entity
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 @Table(name = "grain_fraction")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 public class GrainFraction
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 implements Serializable
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 {
2840
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
23 public static final String TOTAL = "total";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
24 public static final String COARSE = "coarse";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
25 public static final String FINE_MIDDLE = "fine_middle";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
26 public static final String SAND = "sand";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
27 public static final String SUSP_SAND = "susp_sand";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
28 public static final String SUSP_SAND_BED = "susp_sand_bed";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
29 public static final String SUSPENDED_SEDIMENT = "suspended_sediment";
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
30
71175502d868 Added a parser for sediment yield files; started parsing and store values in db.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2837
diff changeset
31
2837
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 private static Logger logger = Logger.getLogger(GrainFraction.class);
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 private Integer id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private String name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 private Double lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private Double upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private Unit unit;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 public GrainFraction() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 public GrainFraction(String name, Double lower, Double upper, Unit unit) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 this.name = name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 this.lower = lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 this.upper = upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 this.unit = unit;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 @Id
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 @SequenceGenerator(
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 name = "SEQUENCE_GRAIN_FRACTION_ID_SEQ",
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 sequenceName = "GRAIN_FRACTION_ID_SEQ",
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 allocationSize = 1)
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 @GeneratedValue(
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 strategy = GenerationType.SEQUENCE,
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 generator = "SEQUENCE_GRAIN_FRACTION_ID_SEQ")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 @Column(name = "id")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 public Integer getId() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 return id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 public void setId(Integer id) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 this.id = id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 @Column(name = "name" )
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public String getName() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 return name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public void setName(String name) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 this.name = name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 @Column(name = "lower")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 public Double getLower() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 return lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 public void setLower(Double lower) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 this.lower = lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 @Column(name = "upper")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 public Double getUpper() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 public void setUpper(Double upper) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 this.upper = upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 @OneToOne
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 @JoinColumn(name = "unit_id")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 public Unit getUnit() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 return unit;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 public void setUnit(Unit unit) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 this.unit = unit;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org