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 com.vividsolutions.jts.geom.Point;
30 import fr.ifremer.quadrige2.core.dao.administration.user.Quser;
31 import fr.ifremer.quadrige2.core.dao.referential.ObjectType;
32 import java.io.Serializable;
33 import java.util.Collection;
34 import java.util.HashSet;
35
36
37
38
39
40 public abstract class Selection
41 implements Serializable, Comparable<Selection>
42 {
43
44
45
46 private static final long serialVersionUID = 4743617357468307693L;
47
48
49 private Integer selId;
50
51
52
53
54
55 public Integer getSelId()
56 {
57 return this.selId;
58 }
59
60
61
62
63
64 public void setSelId(Integer selIdIn)
65 {
66 this.selId = selIdIn;
67 }
68
69 private Integer selSessionId;
70
71
72
73
74
75 public Integer getSelSessionId()
76 {
77 return this.selSessionId;
78 }
79
80
81
82
83
84 public void setSelSessionId(Integer selSessionIdIn)
85 {
86 this.selSessionId = selSessionIdIn;
87 }
88
89 private Point selPosition;
90
91
92
93
94
95 public Point getSelPosition()
96 {
97 return this.selPosition;
98 }
99
100
101
102
103
104 public void setSelPosition(Point selPositionIn)
105 {
106 this.selPosition = selPositionIn;
107 }
108
109
110 private Collection<SelectionItem> selItemGeomObjectIds = new HashSet<SelectionItem>();
111
112
113
114
115
116 public Collection<SelectionItem> getSelItemGeomObjectIds()
117 {
118 return this.selItemGeomObjectIds;
119 }
120
121
122
123
124
125 public void setSelItemGeomObjectIds(Collection<SelectionItem> selItemGeomObjectIdsIn)
126 {
127 this.selItemGeomObjectIds = selItemGeomObjectIdsIn;
128 }
129
130
131
132
133
134
135
136 public boolean addSelItemGeomObjectIds(SelectionItem elementToAdd)
137 {
138 return this.selItemGeomObjectIds.add(elementToAdd);
139 }
140
141
142
143
144
145
146
147 public boolean removeSelItemGeomObjectIds(SelectionItem elementToRemove)
148 {
149 return this.selItemGeomObjectIds.remove(elementToRemove);
150 }
151
152 private ObjectType objectTypeCd;
153
154
155
156
157
158
159
160 public ObjectType getObjectTypeCd()
161 {
162 return this.objectTypeCd;
163 }
164
165
166
167
168
169
170
171 public void setObjectTypeCd(ObjectType objectTypeCdIn)
172 {
173 this.objectTypeCd = objectTypeCdIn;
174 }
175
176 private Quser quserId;
177
178
179
180
181
182 public Quser getQuserId()
183 {
184 return this.quserId;
185 }
186
187
188
189
190
191 public void setQuserId(Quser quserIdIn)
192 {
193 this.quserId = quserIdIn;
194 }
195
196
197
198
199
200 @Override
201 public boolean equals(Object object)
202 {
203 if (this == object)
204 {
205 return true;
206 }
207 if (!(object instanceof Selection))
208 {
209 return false;
210 }
211 final Selection that = (Selection)object;
212 if (this.selId == null || that.getSelId() == null || !this.selId.equals(that.getSelId()))
213 {
214 return false;
215 }
216 return true;
217 }
218
219
220
221
222 @Override
223 public int hashCode()
224 {
225 int hashCode = 0;
226 hashCode = 29 * hashCode + (this.selId == null ? 0 : this.selId.hashCode());
227
228 return hashCode;
229 }
230
231
232
233
234 public static final class Factory
235 {
236
237
238
239
240 public static Selection newInstance()
241 {
242 return new SelectionImpl();
243 }
244
245
246
247
248
249
250
251 public static Selection newInstance(Integer selSessionId)
252 {
253 final Selection entity = new SelectionImpl();
254 entity.setSelSessionId(selSessionId);
255 return entity;
256 }
257
258
259
260
261
262
263
264
265
266
267
268 public static Selection newInstance(Integer selSessionId, Point selPosition, Collection<SelectionItem> selItemGeomObjectIds, ObjectType objectTypeCd, Quser quserId)
269 {
270 final Selection entity = new SelectionImpl();
271 entity.setSelSessionId(selSessionId);
272 entity.setSelPosition(selPosition);
273 entity.setSelItemGeomObjectIds(selItemGeomObjectIds);
274 entity.setObjectTypeCd(objectTypeCd);
275 entity.setQuserId(quserId);
276 return entity;
277 }
278 }
279
280
281
282
283 public int compareTo(Selection o)
284 {
285 int cmp = 0;
286 if (this.getSelId() != null)
287 {
288 cmp = this.getSelId().compareTo(o.getSelId());
289 }
290 else
291 {
292 if (this.getSelSessionId() != null)
293 {
294 cmp = (cmp != 0 ? cmp : this.getSelSessionId().compareTo(o.getSelSessionId()));
295 }
296 if (this.getSelPosition() != null)
297 {
298 cmp = (cmp != 0 ? cmp : this.getSelPosition().compareTo(o.getSelPosition()));
299 }
300 }
301 return cmp;
302 }
303
304
305 }