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.referential.taxon;
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 fr.ifremer.quadrige2.core.dao.referential.Status;
30  import java.io.Serializable;
31  import java.sql.Timestamp;
32  import java.util.Collection;
33  import java.util.Date;
34  import java.util.HashSet;
35  
36  /**
37   * Liste les documents de référence concernant un taxon.
38   */
39  // HibernateEntity.vsl annotations merge-point
40  public abstract class ReferenceDocument
41      implements Serializable, Comparable<ReferenceDocument>
42  {
43      /**
44       * The serial version UID of this class. Needed for serialization.
45       */
46      private static final long serialVersionUID = 5245706815407059828L;
47  
48      // Generate 6 attributes
49      private Integer refDocId;
50  
51      /**
52       * Identifiant interne de la publication
53       * @return this.refDocId Integer
54       */
55      public Integer getRefDocId()
56      {
57          return this.refDocId;
58      }
59  
60      /**
61       * Identifiant interne de la publication
62       * @param refDocIdIn Integer
63       */
64      public void setRefDocId(Integer refDocIdIn)
65      {
66          this.refDocId = refDocIdIn;
67      }
68  
69      private String refDocRefer;
70  
71      /**
72       * Référence de la publication (revue, titre, page, ...)
73       * @return this.refDocRefer String
74       */
75      public String getRefDocRefer()
76      {
77          return this.refDocRefer;
78      }
79  
80      /**
81       * Référence de la publication (revue, titre, page, ...)
82       * @param refDocReferIn String
83       */
84      public void setRefDocRefer(String refDocReferIn)
85      {
86          this.refDocRefer = refDocReferIn;
87      }
88  
89      private Date refDocDt;
90  
91      /**
92       * Date de parution du document
93       * @return this.refDocDt Date
94       */
95      public Date getRefDocDt()
96      {
97          return this.refDocDt;
98      }
99  
100     /**
101      * Date de parution du document
102      * @param refDocDtIn Date
103      */
104     public void setRefDocDt(Date refDocDtIn)
105     {
106         this.refDocDt = refDocDtIn;
107     }
108 
109     private String refDocCm;
110 
111     /**
112      * Commentaire sur la publication
113      * @return this.refDocCm String
114      */
115     public String getRefDocCm()
116     {
117         return this.refDocCm;
118     }
119 
120     /**
121      * Commentaire sur la publication
122      * @param refDocCmIn String
123      */
124     public void setRefDocCm(String refDocCmIn)
125     {
126         this.refDocCm = refDocCmIn;
127     }
128 
129     private Date refDocCreationDt;
130 
131     /**
132      * Date de création de l'objet
133      * @return this.refDocCreationDt Date
134      */
135     public Date getRefDocCreationDt()
136     {
137         return this.refDocCreationDt;
138     }
139 
140     /**
141      * Date de création de l'objet
142      * @param refDocCreationDtIn Date
143      */
144     public void setRefDocCreationDt(Date refDocCreationDtIn)
145     {
146         this.refDocCreationDt = refDocCreationDtIn;
147     }
148 
149     private Timestamp updateDt;
150 
151     /**
152      * Date de maj de l'objet
153      * @return this.updateDt Timestamp
154      */
155     public Timestamp getUpdateDt()
156     {
157         return this.updateDt;
158     }
159 
160     /**
161      * Date de maj de l'objet
162      * @param updateDtIn Timestamp
163      */
164     public void setUpdateDt(Timestamp updateDtIn)
165     {
166         this.updateDt = updateDtIn;
167     }
168 
169     // Generate 5 associations
170     private Status status;
171 
172     /**
173      * Liste des états possibles d'un objet.
174      * @return this.status Status
175      */
176     public Status getStatus()
177     {
178         return this.status;
179     }
180 
181     /**
182      * Liste des états possibles d'un objet.
183      * @param statusIn Status
184      */
185     public void setStatus(Status statusIn)
186     {
187         this.status = statusIn;
188     }
189 
190     private Collection<Author> authors = new HashSet<Author>();
191 
192     /**
193      * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
194      * @return this.authors Collection<Author>
195      */
196     public Collection<Author> getAuthors()
197     {
198         return this.authors;
199     }
200 
201     /**
202      * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
203      * @param authorsIn Collection<Author>
204      */
205     public void setAuthors(Collection<Author> authorsIn)
206     {
207         this.authors = authorsIn;
208     }
209 
210     /**
211      * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
212      * @param elementToAdd Author
213      * @return <tt>true</tt> if this collection changed as a result of the
214      *         call
215      */
216     public boolean addAuthors(Author elementToAdd)
217     {
218         return this.authors.add(elementToAdd);
219     }
220 
221     /**
222      * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
223      * @param elementToRemove Author
224      * @return <tt>true</tt> if this collection changed as a result of the
225      *         call
226      */
227     public boolean removeAuthors(Author elementToRemove)
228     {
229         return this.authors.remove(elementToRemove);
230     }
231 
232     /**
233      * Returns <code>true</code> if the argument is an ReferenceDocument instance and all identifiers for this entity
234      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
235      */
236     @Override
237     public boolean equals(Object object)
238     {
239         if (this == object)
240         {
241             return true;
242         }
243         if (!(object instanceof ReferenceDocument))
244         {
245             return false;
246         }
247         final ReferenceDocument that = (ReferenceDocument)object;
248         if (this.refDocId == null || that.getRefDocId() == null || !this.refDocId.equals(that.getRefDocId()))
249         {
250             return false;
251         }
252         return true;
253     }
254 
255     /**
256      * Returns a hash code based on this entity's identifiers.
257      */
258     @Override
259     public int hashCode()
260     {
261         int hashCode = 0;
262         hashCode = 29 * hashCode + (this.refDocId == null ? 0 : this.refDocId.hashCode());
263 
264         return hashCode;
265     }
266 
267     /**
268      * Constructs new instances of {@link ReferenceDocument}.
269      */
270     public static final class Factory
271     {
272         /**
273          * Constructs a new instance of {@link ReferenceDocument}.
274          * @return new ReferenceDocumentImpl()
275          */
276         public static ReferenceDocument newInstance()
277         {
278             return new ReferenceDocumentImpl();
279         }
280 
281         /**
282          * Constructs a new instance of {@link ReferenceDocument}, taking all required and/or
283          * read-only properties as arguments, except for identifiers.
284          * @param updateDt Timestamp
285          * @param status Status
286          * @return newInstance
287          */
288         public static ReferenceDocument newInstance(Timestamp updateDt, Status status)
289         {
290             final ReferenceDocument entity = new ReferenceDocumentImpl();
291             entity.setUpdateDt(updateDt);
292             entity.setStatus(status);
293             return entity;
294         }
295 
296         /**
297          * Constructs a new instance of {@link ReferenceDocument}, taking all possible properties
298          * (except the identifier(s))as arguments.
299          * @param refDocRefer String
300          * @param refDocDt Date
301          * @param refDocCm String
302          * @param refDocCreationDt Date
303          * @param updateDt Timestamp
304          * @param status Status
305          * @param authors Collection<Author>
306          * @return newInstance ReferenceDocument
307          */
308         public static ReferenceDocument newInstance(String refDocRefer, Date refDocDt, String refDocCm, Date refDocCreationDt, Timestamp updateDt, Status status, Collection<Author> authors)
309         {
310             final ReferenceDocument entity = new ReferenceDocumentImpl();
311             entity.setRefDocRefer(refDocRefer);
312             entity.setRefDocDt(refDocDt);
313             entity.setRefDocCm(refDocCm);
314             entity.setRefDocCreationDt(refDocCreationDt);
315             entity.setUpdateDt(updateDt);
316             entity.setStatus(status);
317             entity.setAuthors(authors);
318             return entity;
319         }
320     }
321 
322     /**
323      * @see Comparable#compareTo
324      */
325     public int compareTo(ReferenceDocument o)
326     {
327         int cmp = 0;
328         if (this.getRefDocId() != null)
329         {
330             cmp = this.getRefDocId().compareTo(o.getRefDocId());
331         }
332         else
333         {
334             if (this.getRefDocRefer() != null)
335             {
336                 cmp = (cmp != 0 ? cmp : this.getRefDocRefer().compareTo(o.getRefDocRefer()));
337             }
338             if (this.getRefDocDt() != null)
339             {
340                 cmp = (cmp != 0 ? cmp : this.getRefDocDt().compareTo(o.getRefDocDt()));
341             }
342             if (this.getRefDocCm() != null)
343             {
344                 cmp = (cmp != 0 ? cmp : this.getRefDocCm().compareTo(o.getRefDocCm()));
345             }
346             if (this.getRefDocCreationDt() != null)
347             {
348                 cmp = (cmp != 0 ? cmp : this.getRefDocCreationDt().compareTo(o.getRefDocCreationDt()));
349             }
350             if (this.getUpdateDt() != null)
351             {
352                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
353             }
354         }
355         return cmp;
356     }
357 // HibernateEntity.vsl merge-point
358 // ReferenceDocument.java merge-point
359 }