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.data.batch;
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.data.measure.QuantificationMeasurement;
032import fr.ifremer.adagio.core.dao.data.operation.FishingOperation;
033import fr.ifremer.adagio.core.dao.data.produce.Produce;
034import fr.ifremer.adagio.core.dao.data.survey.landing.Landing;
035import fr.ifremer.adagio.core.dao.data.survey.sale.Sale;
036import fr.ifremer.adagio.core.dao.referential.QualityFlag;
037import fr.ifremer.adagio.core.dao.referential.location.Location;
038import java.sql.Timestamp;
039import java.util.Collection;
040import java.util.Date;
041import java.util.HashSet;
042
043/**
044 * Capture réalisée au cours d'une opération, et sur laquelle un échantillonnage est réalisé.
045 * La capture porte donc l'arbre d''échantillonnage.
046 */
047// HibernateEntity.vsl annotations merge-point
048public abstract class CatchBatch
049    extends BatchImpl
050{
051    /**
052     * The serial version UID of this class. Needed for serialization.
053     */
054    private static final long serialVersionUID = 2425749807010787327L;
055
056    // Generate 6 attributes
057    
058
059    /**
060     * Etat de synchronisation (en cours, terminé, en attente de synchro, supprimé). Seulement
061     * visible dans la base locale.
062     * @return this.synchronizationStatus String
063     */
064    
065    
066
067    /**
068     * Etat de synchronisation (en cours, terminé, en attente de synchro, supprimé). Seulement
069     * visible dans la base locale.
070     * @param synchronizationStatusIn String
071     */
072    
073    
074
075    private Date controlDate;
076
077    /**
078     * 
079     * @return this.controlDate Date
080     */
081    public Date getControlDate()
082    {
083        return this.controlDate;
084    }
085
086    /**
087     * 
088     * @param controlDateIn Date
089     */
090    public void setControlDate(Date controlDateIn)
091    {
092        this.controlDate = controlDateIn;
093    }
094
095    private Date validationDate;
096
097    /**
098     * 
099     * @return this.validationDate Date
100     */
101    public Date getValidationDate()
102    {
103        return this.validationDate;
104    }
105
106    /**
107     * 
108     * @param validationDateIn Date
109     */
110    public void setValidationDate(Date validationDateIn)
111    {
112        this.validationDate = validationDateIn;
113    }
114
115    private Date qualificationDate;
116
117    /**
118     * 
119     * @return this.qualificationDate Date
120     */
121    public Date getQualificationDate()
122    {
123        return this.qualificationDate;
124    }
125
126    /**
127     * 
128     * @param qualificationDateIn Date
129     */
130    public void setQualificationDate(Date qualificationDateIn)
131    {
132        this.qualificationDate = qualificationDateIn;
133    }
134
135    private String qualificationComments;
136
137    /**
138     * 
139     * @return this.qualificationComments String
140     */
141    public String getQualificationComments()
142    {
143        return this.qualificationComments;
144    }
145
146    /**
147     * 
148     * @param qualificationCommentsIn String
149     */
150    public void setQualificationComments(String qualificationCommentsIn)
151    {
152        this.qualificationComments = qualificationCommentsIn;
153    }
154
155    private Timestamp updateDate;
156
157    /**
158     * 
159     * @return this.updateDate Timestamp
160     */
161    public Timestamp getUpdateDate()
162    {
163        return this.updateDate;
164    }
165
166    /**
167     * 
168     * @param updateDateIn Timestamp
169     */
170    public void setUpdateDate(Timestamp updateDateIn)
171    {
172        this.updateDate = updateDateIn;
173    }
174
175    // Generate 5 associations
176    private Collection<SortingBatch> sortingBatches = new HashSet<SortingBatch>();
177
178    /**
179     * Lot avec critères de classement.
180     * Exemple de critères : 'Débarquement', 'Rejet', 'Vrac', 'Hors Vrac', 'Vidé/Eteté...',
181     * 'Gros/Moyen/Petit'
182     * @return this.sortingBatches Collection<SortingBatch>
183     */
184    public Collection<SortingBatch> getSortingBatches()
185    {
186        return this.sortingBatches;
187    }
188
189    /**
190     * Lot avec critères de classement.
191     * Exemple de critères : 'Débarquement', 'Rejet', 'Vrac', 'Hors Vrac', 'Vidé/Eteté...',
192     * 'Gros/Moyen/Petit'
193     * @param sortingBatchesIn Collection<SortingBatch>
194     */
195    public void setSortingBatches(Collection<SortingBatch> sortingBatchesIn)
196    {
197        this.sortingBatches = sortingBatchesIn;
198    }
199
200    /**
201     * Lot avec critères de classement.
202     * Exemple de critères : 'Débarquement', 'Rejet', 'Vrac', 'Hors Vrac', 'Vidé/Eteté...',
203     * 'Gros/Moyen/Petit'
204     * @param elementToAdd SortingBatch
205     * @return <tt>true</tt> if this collection changed as a result of the
206     *         call
207     */
208    public boolean addSortingBatches(SortingBatch elementToAdd)
209    {
210        return this.sortingBatches.add(elementToAdd);
211    }
212
213    /**
214     * Lot avec critères de classement.
215     * Exemple de critères : 'Débarquement', 'Rejet', 'Vrac', 'Hors Vrac', 'Vidé/Eteté...',
216     * 'Gros/Moyen/Petit'
217     * @param elementToRemove SortingBatch
218     * @return <tt>true</tt> if this collection changed as a result of the
219     *         call
220     */
221    public boolean removeSortingBatches(SortingBatch elementToRemove)
222    {
223        return this.sortingBatches.remove(elementToRemove);
224    }
225
226    private FishingOperation fishingOperation;
227
228    /**
229     * Opération de peche à laquelle est rattachée l'arbre d'échantillonnage (optionnel).
230     * @return this.fishingOperation FishingOperation
231     */
232    public FishingOperation getFishingOperation()
233    {
234        return this.fishingOperation;
235    }
236
237    /**
238     * Opération de peche à laquelle est rattachée l'arbre d'échantillonnage (optionnel).
239     * @param fishingOperationIn FishingOperation
240     */
241    public void setFishingOperation(FishingOperation fishingOperationIn)
242    {
243        this.fishingOperation = fishingOperationIn;
244    }
245
246    private BatchModel batchModel;
247
248    /**
249     * 
250     * @return this.batchModel BatchModel
251     */
252    public BatchModel getBatchModel()
253    {
254        return this.batchModel;
255    }
256
257    /**
258     * 
259     * @param batchModelIn BatchModel
260     */
261    public void setBatchModel(BatchModel batchModelIn)
262    {
263        this.batchModel = batchModelIn;
264    }
265
266    private Landing landing;
267
268    /**
269     * Débarquement auquel est rattaché l'arbre d'échantillonnage (optionnel).
270     * @return this.landing Landing
271     */
272    public Landing getLanding()
273    {
274        return this.landing;
275    }
276
277    /**
278     * Débarquement auquel est rattaché l'arbre d'échantillonnage (optionnel).
279     * @param landingIn Landing
280     */
281    public void setLanding(Landing landingIn)
282    {
283        this.landing = landingIn;
284    }
285
286    private Sale sale;
287
288    /**
289     * Vente à laquelle est rattachée l'arbre d'échantillonnage (optionnel).
290     * @return this.sale Sale
291     */
292    public Sale getSale()
293    {
294        return this.sale;
295    }
296
297    /**
298     * Vente à laquelle est rattachée l'arbre d'échantillonnage (optionnel).
299     * @param saleIn Sale
300     */
301    public void setSale(Sale saleIn)
302    {
303        this.sale = saleIn;
304    }
305
306    /**
307     * This entity does not have any identifiers
308     * but since it extends the <code>BatchImpl</code> class
309     * it will simply delegate the call up there.
310     *
311     * @see Batch#equals(Object)
312     */
313    @Override
314    public boolean equals(Object object)
315    {
316        return super.equals(object);
317    }
318
319    /**
320     * This entity does not have any identifiers
321     * but since it extends the <code>BatchImpl</code> class
322     * it will simply delegate the call up there.
323     *
324     * @see Batch#hashCode()
325     */
326    @Override
327    public int hashCode()
328    {
329        return super.hashCode();
330    }
331
332    /**
333     * Constructs new instances of {@link CatchBatch}.
334     */
335    public static final class Factory
336    {
337        /**
338         * Constructs a new instance of {@link CatchBatch}.
339         * @return new CatchBatchImpl()
340         */
341        public static CatchBatch newInstance()
342        {
343            return new CatchBatchImpl();
344        }
345
346        /**
347         * Constructs a new instance of {@link CatchBatch}, taking all required and/or
348         * read-only properties as arguments, except for identifiers.
349         * @param rankOrder Short
350         * @param childBatchsReplication Boolean
351         * @param exhaustiveInventory Boolean
352         * @param qualityFlag QualityFlag
353         * @return newInstance
354         */
355        public static CatchBatch newInstance(Short rankOrder, Boolean childBatchsReplication, Boolean exhaustiveInventory, QualityFlag qualityFlag)
356        {
357            final CatchBatch entity = new CatchBatchImpl();
358            entity.setRankOrder(rankOrder);
359            entity.setChildBatchsReplication(childBatchsReplication);
360            entity.setExhaustiveInventory(exhaustiveInventory);
361            entity.setQualityFlag(qualityFlag);
362            return entity;
363        }
364
365        /**
366         * Constructs a new instance of {@link CatchBatch}, taking all possible properties
367         * (except the identifier(s))as arguments.
368         * @param rankOrder Short
369         * @param label String
370         * @param subgroupCount Float
371         * @param individualCount Integer
372         * @param childBatchsReplication Boolean
373         * @param exhaustiveInventory Boolean
374         * @param comments String
375         * @param location Location
376         * @param parentBatch Batch
377         * @param childBatchs Collection<Batch>
378         * @param qualityFlag QualityFlag
379         * @param batchExhaustiveInventories Collection<BatchExhaustiveInventory>
380         * @param quantificationMeasurements Collection<QuantificationMeasurement>
381         * @param produces Collection<Produce>
382         * @param synchronizationStatus String
383         * @param controlDate Date
384         * @param validationDate Date
385         * @param qualificationDate Date
386         * @param qualificationComments String
387         * @param updateDate Timestamp
388         * @param sortingBatches Collection<SortingBatch>
389         * @param fishingOperation FishingOperation
390         * @param batchModel BatchModel
391         * @param landing Landing
392         * @param sale Sale
393         * @return newInstance CatchBatch
394         */
395        public static CatchBatch newInstance(Short rankOrder, String label, Float subgroupCount, Integer individualCount, Boolean childBatchsReplication, Boolean exhaustiveInventory, String comments, Location location, Batch parentBatch, Collection<Batch> childBatchs, QualityFlag qualityFlag, Collection<BatchExhaustiveInventory> batchExhaustiveInventories, Collection<QuantificationMeasurement> quantificationMeasurements, Collection<Produce> produces,  Date controlDate, Date validationDate, Date qualificationDate, String qualificationComments, Timestamp updateDate, Collection<SortingBatch> sortingBatches, FishingOperation fishingOperation, BatchModel batchModel, Landing landing, Sale sale)
396        {
397            final CatchBatch entity = new CatchBatchImpl();
398            entity.setRankOrder(rankOrder);
399            entity.setLabel(label);
400            entity.setSubgroupCount(subgroupCount);
401            entity.setIndividualCount(individualCount);
402            entity.setChildBatchsReplication(childBatchsReplication);
403            entity.setExhaustiveInventory(exhaustiveInventory);
404            entity.setComments(comments);
405            entity.setLocation(location);
406            entity.setParentBatch(parentBatch);
407            entity.setChildBatchs(childBatchs);
408            entity.setQualityFlag(qualityFlag);
409            entity.setBatchExhaustiveInventories(batchExhaustiveInventories);
410            entity.setQuantificationMeasurements(quantificationMeasurements);
411            entity.setProduces(produces);
412            
413            entity.setControlDate(controlDate);
414            entity.setValidationDate(validationDate);
415            entity.setQualificationDate(qualificationDate);
416            entity.setQualificationComments(qualificationComments);
417            entity.setUpdateDate(updateDate);
418            entity.setSortingBatches(sortingBatches);
419            entity.setFishingOperation(fishingOperation);
420            entity.setBatchModel(batchModel);
421            entity.setLanding(landing);
422            entity.setSale(sale);
423            return entity;
424        }
425    }
426
427    /**
428     * @see Comparable#compareTo
429     */
430    public int compareTo(CatchBatch o)
431    {
432        int cmp = 0;
433        if (this.getId() != null)
434        {
435            cmp = this.getId().compareTo(o.getId());
436        }
437        else
438        {
439            
440            
441            if (this.getControlDate() != null)
442            {
443                cmp = (cmp != 0 ? cmp : this.getControlDate().compareTo(o.getControlDate()));
444            }
445            if (this.getValidationDate() != null)
446            {
447                cmp = (cmp != 0 ? cmp : this.getValidationDate().compareTo(o.getValidationDate()));
448            }
449            if (this.getQualificationDate() != null)
450            {
451                cmp = (cmp != 0 ? cmp : this.getQualificationDate().compareTo(o.getQualificationDate()));
452            }
453            if (this.getQualificationComments() != null)
454            {
455                cmp = (cmp != 0 ? cmp : this.getQualificationComments().compareTo(o.getQualificationComments()));
456            }
457            if (this.getUpdateDate() != null)
458            {
459                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
460            }
461        }
462        return cmp;
463    }
464// HibernateEntity.vsl merge-point
465// CatchBatch.java merge-point
466
467  protected java.util.Map<Integer, SortingBatch> sortingBatchById = new java.util.HashMap<Integer, SortingBatch>();
468
469  public java.util.Map<Integer, SortingBatch> getSortingBatchById() {
470    return sortingBatchById;
471  }
472
473  public void setSortingBatchById(java.util.Map<Integer, SortingBatch> sortingBatchById) {
474    this.sortingBatchById = sortingBatchById;
475  } 
476  
477  public void putSortingBatchById(Integer sortingBatchId, SortingBatch sortingBatch) {
478    this.sortingBatchById.put(sortingBatchId,sortingBatch);
479  }
480}