001// license-header java merge-point
002//
003// Attention: Generated code! Do not modify by hand!
004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
005//
006package fr.ifremer.adagio.core.dao.referential.grouping;
007
008/*
009 * #%L
010 * SIH-Adagio :: Core
011 * $Id:$
012 * $HeadURL:$
013 * %%
014 * Copyright (C) 2012 - 2014 Ifremer
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Affero General Public License as published by
018 * the Free Software Foundation, either version 3 of the License, or
019 * (at your option) any later version.
020 * 
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Public License for more details.
025 * 
026 * You should have received a copy of the GNU Affero General Public License
027 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
028 * #L%
029 */
030
031import fr.ifremer.adagio.core.dao.referential.ObjectType;
032import java.io.Serializable;
033import java.sql.Timestamp;
034
035/**
036 * <html>
037 * <head>
038 * <style>
039 * p {padding:0px; margin:0px;}
040 * </style>
041 * </head>
042 * <body>
043 * <p>
044 * Une classification de regroupement ne traite que d’un seul type de
045 * données du référentiel à la fois (<i>ObjectType</i>).
046 * Il peut s’agir de regroupement sur les métiers, les lieux, les espèces,
047 * etc.
048 * </p>
049 * <p>
050 * En revanche, un même type de données du référentiel (ex : Métier) peut
051 * avoir plusieurs classification de regroupement distinctes (DCR, Ifremer,
052 * Natura 2000, …)
053 * </p>
054 * <p>
055 * </p>
056 * <p>
057 * Une classification de regroupement peut contenir un ou plusieurs niveaux
058 * de regroupement (<i>GroupingLevel</i>).
059 * </p>
060 * </body>
061 * </html>
062 */
063// HibernateEntity.vsl annotations merge-point
064public abstract class GroupingClassification
065    implements Serializable, Comparable<GroupingClassification>
066{
067    /**
068     * The serial version UID of this class. Needed for serialization.
069     */
070    private static final long serialVersionUID = 8645564444836256070L;
071
072    // Generate 8 attributes
073    private Integer id;
074
075    /**
076     * Identifiant interne. Généré par le système.
077     * @return this.id Integer
078     */
079    public Integer getId()
080    {
081        return this.id;
082    }
083
084    /**
085     * Identifiant interne. Généré par le système.
086     * @param idIn Integer
087     */
088    public void setId(Integer idIn)
089    {
090        this.id = idIn;
091    }
092
093    private String label;
094
095    /**
096     * 
097     * @return this.label String
098     */
099    public String getLabel()
100    {
101        return this.label;
102    }
103
104    /**
105     * 
106     * @param labelIn String
107     */
108    public void setLabel(String labelIn)
109    {
110        this.label = labelIn;
111    }
112
113    private String name;
114
115    /**
116     * 
117     * @return this.name String
118     */
119    public String getName()
120    {
121        return this.name;
122    }
123
124    /**
125     * 
126     * @param nameIn String
127     */
128    public void setName(String nameIn)
129    {
130        this.name = nameIn;
131    }
132
133    private String description;
134
135    /**
136     * 
137     * @return this.description String
138     */
139    public String getDescription()
140    {
141        return this.description;
142    }
143
144    /**
145     * 
146     * @param descriptionIn String
147     */
148    public void setDescription(String descriptionIn)
149    {
150        this.description = descriptionIn;
151    }
152
153    private Boolean isMandatory = Boolean.valueOf(false);
154
155    /**
156     * Permet de savoir si la classification est à maintenir obligatoirement (par l'équipe
157     * d'exploitation).
158     * @return this.isMandatory Boolean
159     */
160    public Boolean isIsMandatory()
161    {
162        return this.isMandatory;
163    }
164
165    /**
166     * Permet de savoir si la classification est à maintenir obligatoirement (par l'équipe
167     * d'exploitation).
168     * @param isMandatoryIn Boolean
169     */
170    public void setIsMandatory(Boolean isMandatoryIn)
171    {
172        this.isMandatory = isMandatoryIn;
173    }
174
175    private String comments;
176
177    /**
178     * 
179     * @return this.comments String
180     */
181    public String getComments()
182    {
183        return this.comments;
184    }
185
186    /**
187     * 
188     * @param commentsIn String
189     */
190    public void setComments(String commentsIn)
191    {
192        this.comments = commentsIn;
193    }
194
195    private Timestamp updateDate;
196
197    /**
198     * 
199     * @return this.updateDate Timestamp
200     */
201    public Timestamp getUpdateDate()
202    {
203        return this.updateDate;
204    }
205
206    /**
207     * 
208     * @param updateDateIn Timestamp
209     */
210    public void setUpdateDate(Timestamp updateDateIn)
211    {
212        this.updateDate = updateDateIn;
213    }
214
215    private String objectReferenceQuery;
216
217    /**
218     * <html>
219     * <head>
220     * <style>
221     * p {padding:0px; margin:0px;}
222     * </style>
223     * </head>
224     * <body>
225     * <p>
226     * A SQL query that must return identifier (column ID or CODE).
227     * </p>
228     * <p>
229     * Use this query to limit a grouping classification type to a list of
230     * entities.
231     * </p>
232     * <p>
233     * </p>
234     * <p>
235     * <b>For instance :</b>
236     * </p>
237     * <ul>
238     * <li>
239     * Limit a grouping classification to commercial species :
240     * </li>
241     * </ul>
242     * <p>
243     * <i>select ID
244     * <br>from TAXON_GROUP
245     * <br>where TAXON_GROUP_TYPE_FK=2 -- FAO species</i>
246     * </p>
247     * </body>
248     * </html>
249     * @return this.objectReferenceQuery String
250     */
251    public String getObjectReferenceQuery()
252    {
253        return this.objectReferenceQuery;
254    }
255
256    /**
257     * <html>
258     * <head>
259     * <style>
260     * p {padding:0px; margin:0px;}
261     * </style>
262     * </head>
263     * <body>
264     * <p>
265     * A SQL query that must return identifier (column ID or CODE).
266     * </p>
267     * <p>
268     * Use this query to limit a grouping classification type to a list of
269     * entities.
270     * </p>
271     * <p>
272     * </p>
273     * <p>
274     * <b>For instance :</b>
275     * </p>
276     * <ul>
277     * <li>
278     * Limit a grouping classification to commercial species :
279     * </li>
280     * </ul>
281     * <p>
282     * <i>select ID
283     * <br>from TAXON_GROUP
284     * <br>where TAXON_GROUP_TYPE_FK=2 -- FAO species</i>
285     * </p>
286     * </body>
287     * </html>
288     * @param objectReferenceQueryIn String
289     */
290    public void setObjectReferenceQuery(String objectReferenceQueryIn)
291    {
292        this.objectReferenceQuery = objectReferenceQueryIn;
293    }
294
295    // Generate 5 associations
296    private ObjectType objectType;
297
298    /**
299     * Liste des types d'objets qui peuvent etre associés à la photo ou à un fichier attaché. Cette
300     * liste
301     * ne peut pas etre modifiée par l'utilisateur.
302     * généralement, il s'agit des noms des tables (en majuscule + underscore)
303     * @return this.objectType ObjectType
304     */
305    public ObjectType getObjectType()
306    {
307        return this.objectType;
308    }
309
310    /**
311     * Liste des types d'objets qui peuvent etre associés à la photo ou à un fichier attaché. Cette
312     * liste
313     * ne peut pas etre modifiée par l'utilisateur.
314     * généralement, il s'agit des noms des tables (en majuscule + underscore)
315     * @param objectTypeIn ObjectType
316     */
317    public void setObjectType(ObjectType objectTypeIn)
318    {
319        this.objectType = objectTypeIn;
320    }
321
322    /**
323     * Returns <code>true</code> if the argument is an GroupingClassification instance and all identifiers for this entity
324     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
325     */
326    @Override
327    public boolean equals(Object object)
328    {
329        if (this == object)
330        {
331            return true;
332        }
333        if (!(object instanceof GroupingClassification))
334        {
335            return false;
336        }
337        final GroupingClassification that = (GroupingClassification)object;
338        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
339        {
340            return false;
341        }
342        return true;
343    }
344
345    /**
346     * Returns a hash code based on this entity's identifiers.
347     */
348    @Override
349    public int hashCode()
350    {
351        int hashCode = 0;
352        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
353
354        return hashCode;
355    }
356
357    /**
358     * Constructs new instances of {@link GroupingClassification}.
359     */
360    public static final class Factory
361    {
362        /**
363         * Constructs a new instance of {@link GroupingClassification}.
364         * @return new GroupingClassificationImpl()
365         */
366        public static GroupingClassification newInstance()
367        {
368            return new GroupingClassificationImpl();
369        }
370
371        /**
372         * Constructs a new instance of {@link GroupingClassification}, taking all required and/or
373         * read-only properties as arguments, except for identifiers.
374         * @param label String
375         * @param name String
376         * @param isMandatory Boolean
377         * @param updateDate Timestamp
378         * @param objectType ObjectType
379         * @return newInstance
380         */
381        public static GroupingClassification newInstance(String label, String name, Boolean isMandatory, Timestamp updateDate, ObjectType objectType)
382        {
383            final GroupingClassification entity = new GroupingClassificationImpl();
384            entity.setLabel(label);
385            entity.setName(name);
386            entity.setIsMandatory(isMandatory);
387            entity.setUpdateDate(updateDate);
388            entity.setObjectType(objectType);
389            return entity;
390        }
391
392        /**
393         * Constructs a new instance of {@link GroupingClassification}, taking all possible properties
394         * (except the identifier(s))as arguments.
395         * @param label String
396         * @param name String
397         * @param description String
398         * @param isMandatory Boolean
399         * @param comments String
400         * @param updateDate Timestamp
401         * @param objectReferenceQuery String
402         * @param objectType ObjectType
403         * @return newInstance GroupingClassification
404         */
405        public static GroupingClassification newInstance(String label, String name, String description, Boolean isMandatory, String comments, Timestamp updateDate, String objectReferenceQuery, ObjectType objectType)
406        {
407            final GroupingClassification entity = new GroupingClassificationImpl();
408            entity.setLabel(label);
409            entity.setName(name);
410            entity.setDescription(description);
411            entity.setIsMandatory(isMandatory);
412            entity.setComments(comments);
413            entity.setUpdateDate(updateDate);
414            entity.setObjectReferenceQuery(objectReferenceQuery);
415            entity.setObjectType(objectType);
416            return entity;
417        }
418    }
419
420    /**
421     * @see Comparable#compareTo
422     */
423    public int compareTo(GroupingClassification o)
424    {
425        int cmp = 0;
426        if (this.getId() != null)
427        {
428            cmp = this.getId().compareTo(o.getId());
429        }
430        else
431        {
432            if (this.getLabel() != null)
433            {
434                cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel()));
435            }
436            if (this.getName() != null)
437            {
438                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
439            }
440            if (this.getDescription() != null)
441            {
442                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
443            }
444            if (this.isIsMandatory() != null)
445            {
446                cmp = (cmp != 0 ? cmp : this.isIsMandatory().compareTo(o.isIsMandatory()));
447            }
448            if (this.getComments() != null)
449            {
450                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
451            }
452            if (this.getUpdateDate() != null)
453            {
454                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
455            }
456            if (this.getObjectReferenceQuery() != null)
457            {
458                cmp = (cmp != 0 ? cmp : this.getObjectReferenceQuery().compareTo(o.getObjectReferenceQuery()));
459            }
460        }
461        return cmp;
462    }
463// HibernateEntity.vsl merge-point
464// GroupingClassification.java merge-point
465}