annotate backend/src/main/java/org/dive4elements/river/model/GrainFraction.java @ 8029:cdb9f6d97f6a

Added method to importer session to fetch the measurement station for given (river, km).
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 10 Jul 2014 18:02:08 +0200
parents 9ec6def1a7dd
children 9d2e69f971f5
rev   line source
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5992
4c3ccf2b0304 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5844
diff changeset
6 * documentation coming with Dive4Elements River for details.
5844
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4dd33b86dc61 Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5829
18619c1e7c2a Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5828
diff changeset
9 package org.dive4elements.river.model;
2837
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.Entity;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.persistence.Id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import javax.persistence.Table;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import javax.persistence.GeneratedValue;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import javax.persistence.Column;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import javax.persistence.SequenceGenerator;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import javax.persistence.GenerationType;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import org.apache.log4j.Logger;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 @Entity
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 @Table(name = "grain_fraction")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public class GrainFraction
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 implements Serializable
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 {
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
29 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
30 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
31 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
32 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
33 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
34 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
35 public static final String SUSPENDED_SEDIMENT = "suspended_sediment";
7917
9ec6def1a7dd Make grain fraction type 'unknown' explicit and use it where appropriate.
Tom Gottfried <tom@intevation.de>
parents: 5992
diff changeset
36 public static final String UNKNOWN = "unknown";
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
37
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
38
2837
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 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
40
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private Integer id;
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 private String name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 private Double lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 private Double upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 public GrainFraction() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
5439
7aeb2c101628 removed unit from model and importer for grain fractions (its always mm, otherwise a typo)
Tom Gottfried <tom.gottfried@intevation.de>
parents: 2840
diff changeset
52 public GrainFraction(String name, Double lower, Double upper) {
2837
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 this.name = name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 this.lower = lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 this.upper = upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 @Id
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 @SequenceGenerator(
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 name = "SEQUENCE_GRAIN_FRACTION_ID_SEQ",
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 sequenceName = "GRAIN_FRACTION_ID_SEQ",
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 allocationSize = 1)
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 @GeneratedValue(
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 strategy = GenerationType.SEQUENCE,
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 generator = "SEQUENCE_GRAIN_FRACTION_ID_SEQ")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 @Column(name = "id")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 public Integer getId() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 return 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 public void setId(Integer id) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 this.id = id;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
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 @Column(name = "name" )
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public String getName() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 return 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 public void setName(String name) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 this.name = name;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 }
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 @Column(name = "lower")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 public Double getLower() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 return 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 public void setLower(Double lower) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 this.lower = lower;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
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 @Column(name = "upper")
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 public Double getUpper() {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 return 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 public void setUpper(Double upper) {
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 this.upper = upper;
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
8b910e3277b0 Added new model classes for sediment yield data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org