View Javadoc
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 java.io.Serializable;
30  import java.sql.Timestamp;
31  import java.util.Collection;
32  import java.util.HashSet;
33  
34  /**
35   * Localisations pouvant être utilisées pour initialiser la localisation des passages.
36   */
37  // HibernateEntity.vsl annotations merge-point
38  public abstract class Location
39      implements Serializable, Comparable<Location>
40  {
41      /**
42       * The serial version UID of this class. Needed for serialization.
43       */
44      private static final long serialVersionUID = -4044959175915177383L;
45  
46      // Generate 5 attributes
47      private Integer locId;
48  
49      /**
50       * Identifiant de la localisation
51       * @return this.locId Integer
52       */
53      public Integer getLocId()
54      {
55          return this.locId;
56      }
57  
58      /**
59       * Identifiant de la localisation
60       * @param locIdIn Integer
61       */
62      public void setLocId(Integer locIdIn)
63      {
64          this.locId = locIdIn;
65      }
66  
67      private String locLb;
68  
69      /**
70       * Mnémonique de la localisation
71       * @return this.locLb String
72       */
73      public String getLocLb()
74      {
75          return this.locLb;
76      }
77  
78      /**
79       * Mnémonique de la localisation
80       * @param locLbIn String
81       */
82      public void setLocLb(String locLbIn)
83      {
84          this.locLb = locLbIn;
85      }
86  
87      private String locNm;
88  
89      /**
90       * Libellé de la localisation
91       * @return this.locNm String
92       */
93      public String getLocNm()
94      {
95          return this.locNm;
96      }
97  
98      /**
99       * Libellé de la localisation
100      * @param locNmIn String
101      */
102     public void setLocNm(String locNmIn)
103     {
104         this.locNm = locNmIn;
105     }
106 
107     private String locDc;
108 
109     /**
110      * Description de la localisation
111      * @return this.locDc String
112      */
113     public String getLocDc()
114     {
115         return this.locDc;
116     }
117 
118     /**
119      * Description de la localisation
120      * @param locDcIn String
121      */
122     public void setLocDc(String locDcIn)
123     {
124         this.locDc = locDcIn;
125     }
126 
127     private Timestamp updateDt;
128 
129     /**
130      * 
131      * @return this.updateDt Timestamp
132      */
133     public Timestamp getUpdateDt()
134     {
135         return this.updateDt;
136     }
137 
138     /**
139      * 
140      * @param updateDtIn Timestamp
141      */
142     public void setUpdateDt(Timestamp updateDtIn)
143     {
144         this.updateDt = updateDtIn;
145     }
146 
147     // Generate 1 associations
148     private Collection<LocPoint> locPointIds = new HashSet<LocPoint>();
149 
150     /**
151      * Gestion de la géométrie ponctuelle des localisations
152      * @return this.locPointIds Collection<LocPoint>
153      */
154     public Collection<LocPoint> getLocPointIds()
155     {
156         return this.locPointIds;
157     }
158 
159     /**
160      * Gestion de la géométrie ponctuelle des localisations
161      * @param locPointIdsIn Collection<LocPoint>
162      */
163     public void setLocPointIds(Collection<LocPoint> locPointIdsIn)
164     {
165         this.locPointIds = locPointIdsIn;
166     }
167 
168     /**
169      * Gestion de la géométrie ponctuelle des localisations
170      * @param elementToAdd LocPoint
171      * @return <tt>true</tt> if this collection changed as a result of the
172      *         call
173      */
174     public boolean addLocPointIds(LocPoint elementToAdd)
175     {
176         return this.locPointIds.add(elementToAdd);
177     }
178 
179     /**
180      * Gestion de la géométrie ponctuelle des localisations
181      * @param elementToRemove LocPoint
182      * @return <tt>true</tt> if this collection changed as a result of the
183      *         call
184      */
185     public boolean removeLocPointIds(LocPoint elementToRemove)
186     {
187         return this.locPointIds.remove(elementToRemove);
188     }
189 
190     /**
191      * Returns <code>true</code> if the argument is an Location instance and all identifiers for this entity
192      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
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      * Returns a hash code based on this entity's identifiers.
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      * Constructs new instances of {@link Location}.
227      */
228     public static final class Factory
229     {
230         /**
231          * Constructs a new instance of {@link Location}.
232          * @return new LocationImpl()
233          */
234         public static Location newInstance()
235         {
236             return new LocationImpl();
237         }
238 
239         /**
240          * Constructs a new instance of {@link Location}, taking all required and/or
241          * read-only properties as arguments, except for identifiers.
242          * @param locLb String
243          * @param locNm String
244          * @param updateDt Timestamp
245          * @return newInstance
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          * Constructs a new instance of {@link Location}, taking all possible properties
258          * (except the identifier(s))as arguments.
259          * @param locLb String
260          * @param locNm String
261          * @param locDc String
262          * @param updateDt Timestamp
263          * @param locPointIds Collection<LocPoint>
264          * @return newInstance Location
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      * @see Comparable#compareTo
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 // HibernateEntity.vsl merge-point
310 // Location.java merge-point
311 }