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