annotate flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java @ 5152:b26465581abf

Add a configurable path prefix to relative DGM path to allways have an absolute path.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 01 Mar 2013 10:35:38 +0100
parents 20b6ebf23916
children
rev   line source
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
4 import java.util.Date;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
5 import java.util.List;
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
7 import javax.persistence.Column;
171
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
8 import javax.persistence.Entity;
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
9 import javax.persistence.GeneratedValue;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
10 import javax.persistence.GenerationType;
171
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
11 import javax.persistence.Id;
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
12 import javax.persistence.JoinColumn;
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
13 import javax.persistence.OneToMany;
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
14 import javax.persistence.OneToOne;
2425
67f362883fe4 flys/issue499: Sort the values of the discharge table by Q.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 493
diff changeset
15 import javax.persistence.OrderBy;
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
16 import javax.persistence.SequenceGenerator;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
17 import javax.persistence.Table;
171
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
18
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
19 @Entity
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
20 @Table(name = "discharge_tables")
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 public class DischargeTable
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
22 implements Serializable, Comparable<DischargeTable>
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 {
172
605320b7df94 Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 171
diff changeset
24 private Integer id;
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 private Gauge gauge;
493
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
26 private String description;
4776
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
27 private String bfgId;
467
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
28 private Integer kind;
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 private TimeInterval timeInterval;
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
31 private List<DischargeTableValue> dischargeTableValues;
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
32
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 public DischargeTable() {
467
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
34 kind = 0;
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 }
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36
198
d980e545ccab Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 174
diff changeset
37 public DischargeTable(Gauge gauge) {
4776
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
38 this(gauge, null, null, 0, null);
467
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
39 }
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
40
493
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
41 public DischargeTable(
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
42 Gauge gauge,
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
43 String description,
4776
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
44 String bfgId,
493
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
45 Integer kind,
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
46 TimeInterval timeInterval
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
47 ) {
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
48 this.gauge = gauge;
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
49 this.description = description;
4776
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
50 this.bfgId = bfgId;
493
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
51 this.kind = kind;
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
52 this.timeInterval = timeInterval;
198
d980e545ccab Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 174
diff changeset
53 }
d980e545ccab Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 174
diff changeset
54
171
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
55 @Id
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
56 @SequenceGenerator(
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
57 name = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ",
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
58 sequenceName = "DISCHARGE_TABLES_ID_SEQ",
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
59 allocationSize = 1)
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
60 @GeneratedValue(
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
61 strategy = GenerationType.SEQUENCE,
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
62 generator = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ")
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
63 @Column(name = "id")
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
64 public Integer getId() {
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
65 return id;
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
66 }
4a83e14f40f9 Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 168
diff changeset
67
168
86a1bd9cc50e More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 167
diff changeset
68 public void setId(Integer id) {
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 this.id = id;
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 }
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
72 @OneToOne
467
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
73 @JoinColumn(name = "gauge_id" )
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
74 public Gauge getGauge() {
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
75 return gauge;
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
76 }
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
77
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
78 public void setGauge(Gauge gauge) {
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
79 this.gauge = gauge;
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
80 }
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
81
493
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
82 @Column(name = "description")
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
83 public String getDescription() {
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
84 return description;
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
85 }
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
86
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
87 public void setDescription(String description) {
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
88 this.description = description;
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
89 }
b35c5dc0f8b7 Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
90
4776
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
91 @Column(name = "bfg_id")
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
92 public String getBfgId() {
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
93 return bfgId;
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
94 }
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
95
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
96 public void setBfgId(String bfgId) {
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
97 this.bfgId = bfgId;
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
98 }
20b6ebf23916 !!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4227
diff changeset
99
467
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
100 @Column(name = "kind")
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
101 public Integer getKind() {
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
102 return kind;
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
103 }
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
104
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
105 public void setKind(Integer kind) {
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
106 this.kind = kind;
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
107 }
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
108
c8c09e31cdb8 Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 198
diff changeset
109 @OneToOne
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
110 @JoinColumn(name = "time_interval_id" )
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
111 public TimeInterval getTimeInterval() {
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
112 return timeInterval;
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
113 }
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
114
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115 public void setTimeInterval(TimeInterval timeInterval) {
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 this.timeInterval = timeInterval;
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 }
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
119 @OneToMany
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
120 @JoinColumn(name = "table_id")
2425
67f362883fe4 flys/issue499: Sort the values of the discharge table by Q.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 493
diff changeset
121 @OrderBy("q")
174
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
122 public List<DischargeTableValue> getDischargeTableValues() {
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
123 return dischargeTableValues;
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
124 }
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
125
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
126 public void setDischargeTableValues(
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
127 List<DischargeTableValue> dischargeTableValues
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
128 ) {
249390dd24e7 Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 172
diff changeset
129 this.dischargeTableValues = dischargeTableValues;
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 }
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
131
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
132 @Override
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
133 public int compareTo(DischargeTable o) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
134 if (getKind() == 0 && o.getKind() != 0) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
135 return 1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
136 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
137
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
138 TimeInterval other = o.getTimeInterval();
4227
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
139 if (other == null && timeInterval == null) {
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
140 return 1;
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
141 }
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
142 else if (other == null) {
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
143 return -1;
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
144 }
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
145 else if (timeInterval == null) {
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
146 return 1;
8138a90a674a Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 4173
diff changeset
147 }
4173
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
148
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
149 Date otherStartTime = other.getStartTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
150 Date thisStartTime = timeInterval.getStartTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
151
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
152 if (otherStartTime == null) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
153 return -1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
154 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
155 else if (thisStartTime == null) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
156 return 1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
157 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
158
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
159 long otherStart = otherStartTime.getTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
160 long thisStart = thisStartTime.getTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
161
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
162 if (otherStart < thisStart) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
163 return 1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
164 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
165 else if (otherStart > thisStart) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
166 return -1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
167 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
168
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
169 Date otherStopTime = other.getStopTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
170 Date thisStopTime = timeInterval.getStopTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
171
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
172 if (otherStopTime == null) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
173 return -1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
174 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
175 else if (thisStopTime == null) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
176 return 1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
177 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
178
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
179 long otherEnd = otherStopTime.getTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
180 long thisEnd = thisStopTime.getTime();
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
181
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
182 if (otherEnd < thisEnd) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
183 return 1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
184 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
185 else if (otherEnd > thisEnd) {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
186 return -1;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
187 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
188 else {
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
189 return 0;
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
190 }
7d4480c0e68e Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2425
diff changeset
191 }
167
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
192 }
15d515fe15f5 Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org