1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5 //
6 package fr.ifremer.quadrige2.core.dao.system;
7
8 /*-
9 * #%L
10 * Quadrige2 Core :: Server API
11 * %%
12 * Copyright (C) 2017 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
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 * Liste des sélections cartographique.
38 */
39 // HibernateEntity.vsl annotations merge-point
40 public abstract class Selection
41 implements Serializable, Comparable<Selection>
42 {
43 /**
44 * The serial version UID of this class. Needed for serialization.
45 */
46 private static final long serialVersionUID = 4743617357468307693L;
47
48 // Generate 3 attributes
49 private Integer selId;
50
51 /**
52 * Identifiant interne de la sélection
53 * @return this.selId Integer
54 */
55 public Integer getSelId()
56 {
57 return this.selId;
58 }
59
60 /**
61 * Identifiant interne de la sélection
62 * @param selIdIn Integer
63 */
64 public void setSelId(Integer selIdIn)
65 {
66 this.selId = selIdIn;
67 }
68
69 private Integer selSessionId;
70
71 /**
72 * Identifiant de la session utilisateur
73 * @return this.selSessionId Integer
74 */
75 public Integer getSelSessionId()
76 {
77 return this.selSessionId;
78 }
79
80 /**
81 * Identifiant de la session utilisateur
82 * @param selSessionIdIn Integer
83 */
84 public void setSelSessionId(Integer selSessionIdIn)
85 {
86 this.selSessionId = selSessionIdIn;
87 }
88
89 private Point selPosition;
90
91 /**
92 * Géométries sélectionnées
93 * @return this.selPosition Point
94 */
95 public Point getSelPosition()
96 {
97 return this.selPosition;
98 }
99
100 /**
101 * Géométries sélectionnées
102 * @param selPositionIn Point
103 */
104 public void setSelPosition(Point selPositionIn)
105 {
106 this.selPosition = selPositionIn;
107 }
108
109 // Generate 3 associations
110 private Collection<SelectionItem> selItemGeomObjectIds = new HashSet<SelectionItem>();
111
112 /**
113 * Liste des objets sélectionnés dans la vue cartographique.
114 * @return this.selItemGeomObjectIds Collection<SelectionItem>
115 */
116 public Collection<SelectionItem> getSelItemGeomObjectIds()
117 {
118 return this.selItemGeomObjectIds;
119 }
120
121 /**
122 * Liste des objets sélectionnés dans la vue cartographique.
123 * @param selItemGeomObjectIdsIn Collection<SelectionItem>
124 */
125 public void setSelItemGeomObjectIds(Collection<SelectionItem> selItemGeomObjectIdsIn)
126 {
127 this.selItemGeomObjectIds = selItemGeomObjectIdsIn;
128 }
129
130 /**
131 * Liste des objets sélectionnés dans la vue cartographique.
132 * @param elementToAdd SelectionItem
133 * @return <tt>true</tt> if this collection changed as a result of the
134 * call
135 */
136 public boolean addSelItemGeomObjectIds(SelectionItem elementToAdd)
137 {
138 return this.selItemGeomObjectIds.add(elementToAdd);
139 }
140
141 /**
142 * Liste des objets sélectionnés dans la vue cartographique.
143 * @param elementToRemove SelectionItem
144 * @return <tt>true</tt> if this collection changed as a result of the
145 * call
146 */
147 public boolean removeSelItemGeomObjectIds(SelectionItem elementToRemove)
148 {
149 return this.selItemGeomObjectIds.remove(elementToRemove);
150 }
151
152 private ObjectType objectTypeCd;
153
154 /**
155 * Liste des types d'objets qui peuvent être associés à la photo ou à un résultat. Cette liste
156 * ne peut
157 * pas être modifiée par l'utilisateur.
158 * @return this.objectTypeCd ObjectType
159 */
160 public ObjectType getObjectTypeCd()
161 {
162 return this.objectTypeCd;
163 }
164
165 /**
166 * Liste des types d'objets qui peuvent être associés à la photo ou à un résultat. Cette liste
167 * ne peut
168 * pas être modifiée par l'utilisateur.
169 * @param objectTypeCdIn ObjectType
170 */
171 public void setObjectTypeCd(ObjectType objectTypeCdIn)
172 {
173 this.objectTypeCd = objectTypeCdIn;
174 }
175
176 private Quser quserId;
177
178 /**
179 * Liste l'ensemble des agents et utilisateurs du système.
180 * @return this.quserId Quser
181 */
182 public Quser getQuserId()
183 {
184 return this.quserId;
185 }
186
187 /**
188 * Liste l'ensemble des agents et utilisateurs du système.
189 * @param quserIdIn Quser
190 */
191 public void setQuserId(Quser quserIdIn)
192 {
193 this.quserId = quserIdIn;
194 }
195
196 /**
197 * Returns <code>true</code> if the argument is an Selection instance and all identifiers for this entity
198 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
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 * Returns a hash code based on this entity's identifiers.
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 * Constructs new instances of {@link Selection}.
233 */
234 public static final class Factory
235 {
236 /**
237 * Constructs a new instance of {@link Selection}.
238 * @return new SelectionImpl()
239 */
240 public static Selection newInstance()
241 {
242 return new SelectionImpl();
243 }
244
245 /**
246 * Constructs a new instance of {@link Selection}, taking all required and/or
247 * read-only properties as arguments, except for identifiers.
248 * @param selSessionId Integer
249 * @return newInstance
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 * Constructs a new instance of {@link Selection}, taking all possible properties
260 * (except the identifier(s))as arguments.
261 * @param selSessionId Integer
262 * @param selPosition Point
263 * @param selItemGeomObjectIds Collection<SelectionItem>
264 * @param objectTypeCd ObjectType
265 * @param quserId Quser
266 * @return newInstance Selection
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 * @see Comparable#compareTo
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 // HibernateEntity.vsl merge-point
304 // Selection.java merge-point
305 }