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