1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.system;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import java.io.Serializable;
29 import java.sql.Timestamp;
30 import java.util.Collection;
31 import java.util.HashSet;
32
33
34
35
36
37 public abstract class Location
38 implements Serializable, Comparable<Location>
39 {
40
41
42
43 private static final long serialVersionUID = -4044959175915177383L;
44
45
46 private Integer locId;
47
48
49
50
51
52 public Integer getLocId()
53 {
54 return this.locId;
55 }
56
57
58
59
60
61 public void setLocId(Integer locIdIn)
62 {
63 this.locId = locIdIn;
64 }
65
66 private String locLb;
67
68
69
70
71
72 public String getLocLb()
73 {
74 return this.locLb;
75 }
76
77
78
79
80
81 public void setLocLb(String locLbIn)
82 {
83 this.locLb = locLbIn;
84 }
85
86 private String locNm;
87
88
89
90
91
92 public String getLocNm()
93 {
94 return this.locNm;
95 }
96
97
98
99
100
101 public void setLocNm(String locNmIn)
102 {
103 this.locNm = locNmIn;
104 }
105
106 private String locDc;
107
108
109
110
111
112 public String getLocDc()
113 {
114 return this.locDc;
115 }
116
117
118
119
120
121 public void setLocDc(String locDcIn)
122 {
123 this.locDc = locDcIn;
124 }
125
126 private Timestamp updateDt;
127
128
129
130
131
132 public Timestamp getUpdateDt()
133 {
134 return this.updateDt;
135 }
136
137
138
139
140
141 public void setUpdateDt(Timestamp updateDtIn)
142 {
143 this.updateDt = updateDtIn;
144 }
145
146
147 private Collection<LocPoint> locPoints = new HashSet<LocPoint>();
148
149
150
151
152
153 public Collection<LocPoint> getLocPoints()
154 {
155 return this.locPoints;
156 }
157
158
159
160
161
162 public void setLocPoints(Collection<LocPoint> locPointsIn)
163 {
164 this.locPoints = locPointsIn;
165 }
166
167
168
169
170
171
172
173 public boolean addLocPoints(LocPoint elementToAdd)
174 {
175 return this.locPoints.add(elementToAdd);
176 }
177
178
179
180
181
182
183
184 public boolean removeLocPoints(LocPoint elementToRemove)
185 {
186 return this.locPoints.remove(elementToRemove);
187 }
188
189
190
191
192
193 @Override
194 public boolean equals(Object object)
195 {
196 if (this == object)
197 {
198 return true;
199 }
200 if (!(object instanceof Location))
201 {
202 return false;
203 }
204 final Location that = (Location)object;
205 if (this.locId == null || that.getLocId() == null || !this.locId.equals(that.getLocId()))
206 {
207 return false;
208 }
209 return true;
210 }
211
212
213
214
215 @Override
216 public int hashCode()
217 {
218 int hashCode = 0;
219 hashCode = 29 * hashCode + (this.locId == null ? 0 : this.locId.hashCode());
220
221 return hashCode;
222 }
223
224
225
226
227 public static final class Factory
228 {
229
230
231
232
233 public static Location newInstance()
234 {
235 return new LocationImpl();
236 }
237
238
239
240
241
242
243
244
245 public static Location newInstance(String locLb, String locNm)
246 {
247 final Location entity = new LocationImpl();
248 entity.setLocLb(locLb);
249 entity.setLocNm(locNm);
250 return entity;
251 }
252
253
254
255
256
257
258
259
260
261
262
263 public static Location newInstance(String locLb, String locNm, String locDc, Timestamp updateDt, Collection<LocPoint> locPoints)
264 {
265 final Location entity = new LocationImpl();
266 entity.setLocLb(locLb);
267 entity.setLocNm(locNm);
268 entity.setLocDc(locDc);
269 entity.setUpdateDt(updateDt);
270 entity.setLocPoints(locPoints);
271 return entity;
272 }
273 }
274
275
276
277
278 public int compareTo(Location o)
279 {
280 int cmp = 0;
281 if (this.getLocId() != null)
282 {
283 cmp = this.getLocId().compareTo(o.getLocId());
284 }
285 else
286 {
287 if (this.getLocLb() != null)
288 {
289 cmp = (cmp != 0 ? cmp : this.getLocLb().compareTo(o.getLocLb()));
290 }
291 if (this.getLocNm() != null)
292 {
293 cmp = (cmp != 0 ? cmp : this.getLocNm().compareTo(o.getLocNm()));
294 }
295 if (this.getLocDc() != null)
296 {
297 cmp = (cmp != 0 ? cmp : this.getLocDc().compareTo(o.getLocDc()));
298 }
299 if (this.getUpdateDt() != null)
300 {
301 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
302 }
303 }
304 return cmp;
305 }
306
307
308 }