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.measure;
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.administration.user.Department;
032import fr.ifremer.adagio.core.dao.data.batch.Batch;
033import fr.ifremer.adagio.core.dao.referential.AnalysisInstrument;
034import fr.ifremer.adagio.core.dao.referential.NumericalPrecision;
035import fr.ifremer.adagio.core.dao.referential.PrecisionType;
036import fr.ifremer.adagio.core.dao.referential.QualityFlag;
037import fr.ifremer.adagio.core.dao.referential.pmfm.AggregationLevel;
038import fr.ifremer.adagio.core.dao.referential.pmfm.Pmfm;
039import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValue;
040import java.util.Date;
041
042/**
043 * Résultat de mesure de quantification d'un lot.
044 * Les mesures de quantification portent sur le paramètre "Poids". Elle peuvent être obtenue par
045 * différentes méthodes :
046 * - mesuré (ex : par une règle ou Ichtyomètre),
047 * - estimé (ex : jugement par un expert),
048 * - calculé par une relation taille/poids
049 * - calculé à partir de volumes (nombre d'unité de volume x Poids d'une unité de volume). Il s'agit
050 * donc d'un poids estimé, mais par le volume.
051 * - déclaré (cf SACROIS/RIC2)
052 */
053// HibernateEntity.vsl annotations merge-point
054public abstract class QuantificationMeasurement
055    extends MeasurementImpl
056{
057    /**
058     * The serial version UID of this class. Needed for serialization.
059     */
060    private static final long serialVersionUID = -9133401313776729152L;
061
062    // Generate 2 attributes
063    private Short subgroupNumber;
064
065    /**
066     * Numéro du sous ensemble sur lequel porte la mesure de quantification. Si non renseigné, le
067     * mesure porte sur tout le lot rattaché.Une quantification d'un lot peut faire intervenir
068     * plusieurs sous-ensemble sur lequel des mesures sont éffectuées. Par exemple, plusieurs
069     * sous-ensembles peuvent être quantifié par pesée, chaque mesure est donc rattaché à un
070     * sous-ensemmble, via le numéro de sous ensemble.
071     * @return this.subgroupNumber Short
072     */
073    public Short getSubgroupNumber()
074    {
075        return this.subgroupNumber;
076    }
077
078    /**
079     * Numéro du sous ensemble sur lequel porte la mesure de quantification. Si non renseigné, le
080     * mesure porte sur tout le lot rattaché.Une quantification d'un lot peut faire intervenir
081     * plusieurs sous-ensemble sur lequel des mesures sont éffectuées. Par exemple, plusieurs
082     * sous-ensembles peuvent être quantifié par pesée, chaque mesure est donc rattaché à un
083     * sous-ensemmble, via le numéro de sous ensemble.
084     * @param subgroupNumberIn Short
085     */
086    public void setSubgroupNumber(Short subgroupNumberIn)
087    {
088        this.subgroupNumber = subgroupNumberIn;
089    }
090
091    private Boolean isReferenceQuantification;
092
093    /**
094     * S'agit t il de la mesure de référence pour la quantification du lot ? Par défaut, le poids
095     * calculé (par relation taille/poids) est le poids de référence.
096     * Doit etre NULL si subgroupNumber est NULL (un poids de référence ne peut pas porter sur une
097     * sous-ensemble du lot , mais sur tout le lot)
098     * @return this.isReferenceQuantification Boolean
099     */
100    public Boolean getIsReferenceQuantification()
101    {
102        return this.isReferenceQuantification;
103    }
104
105    /**
106     * S'agit t il de la mesure de référence pour la quantification du lot ? Par défaut, le poids
107     * calculé (par relation taille/poids) est le poids de référence.
108     * Doit etre NULL si subgroupNumber est NULL (un poids de référence ne peut pas porter sur une
109     * sous-ensemble du lot , mais sur tout le lot)
110     * @param isReferenceQuantificationIn Boolean
111     */
112    public void setIsReferenceQuantification(Boolean isReferenceQuantificationIn)
113    {
114        this.isReferenceQuantification = isReferenceQuantificationIn;
115    }
116
117    // Generate 1 associations
118    private Batch batch;
119
120    /**
121     * Lot auquel est rattaché la mesure de quantification (optionnel).
122     * @return this.batch Batch
123     */
124    public Batch getBatch()
125    {
126        return this.batch;
127    }
128
129    /**
130     * Lot auquel est rattaché la mesure de quantification (optionnel).
131     * @param batchIn Batch
132     */
133    public void setBatch(Batch batchIn)
134    {
135        this.batch = batchIn;
136    }
137
138    /**
139     * This entity does not have any identifiers
140     * but since it extends the <code>MeasurementImpl</code> class
141     * it will simply delegate the call up there.
142     *
143     * @see fr.ifremer.adagio.core.dao.data.measure.Measurement#equals(Object)
144     */
145    @Override
146    public boolean equals(Object object)
147    {
148        return super.equals(object);
149    }
150
151    /**
152     * This entity does not have any identifiers
153     * but since it extends the <code>MeasurementImpl</code> class
154     * it will simply delegate the call up there.
155     *
156     * @see fr.ifremer.adagio.core.dao.data.measure.Measurement#hashCode()
157     */
158    @Override
159    public int hashCode()
160    {
161        return super.hashCode();
162    }
163
164    /**
165     * Constructs new instances of {@link QuantificationMeasurement}.
166     */
167    public static final class Factory
168    {
169        /**
170         * Constructs a new instance of {@link QuantificationMeasurement}.
171         * @return new QuantificationMeasurementImpl()
172         */
173        public static QuantificationMeasurement newInstance()
174        {
175            return new QuantificationMeasurementImpl();
176        }
177
178        /**
179         * Constructs a new instance of {@link QuantificationMeasurement}, taking all required and/or
180         * read-only properties as arguments, except for identifiers.
181         * @param qualityFlag QualityFlag
182         * @param pmfm Pmfm
183         * @param batch Batch
184         * @return newInstance
185         */
186        public static QuantificationMeasurement newInstance(QualityFlag qualityFlag, Pmfm pmfm, Batch batch)
187        {
188            final QuantificationMeasurement entity = new QuantificationMeasurementImpl();
189            entity.setQualityFlag(qualityFlag);
190            entity.setPmfm(pmfm);
191            entity.setBatch(batch);
192            return entity;
193        }
194
195        /**
196         * Constructs a new instance of {@link QuantificationMeasurement}, taking all possible properties
197         * (except the identifier(s))as arguments.
198         * @param numericalValue Float
199         * @param alphanumericalValue String
200         * @param digitCount Integer
201         * @param precisionValue Float
202         * @param controlDate Date
203         * @param validationDate Date
204         * @param qualificationDate Date
205         * @param qualificationComments String
206         * @param aggregationLevel AggregationLevel
207         * @param qualitativeValue QualitativeValue
208         * @param qualityFlag QualityFlag
209         * @param precisionType PrecisionType
210         * @param analysisInstrument AnalysisInstrument
211         * @param pmfm Pmfm
212         * @param department Department
213         * @param numericalPrecision NumericalPrecision
214         * @param subgroupNumber Short
215         * @param isReferenceQuantification Boolean
216         * @param batch Batch
217         * @return newInstance QuantificationMeasurement
218         */
219        public static QuantificationMeasurement newInstance(Float numericalValue, String alphanumericalValue, Integer digitCount, Float precisionValue, Date controlDate, Date validationDate, Date qualificationDate, String qualificationComments, AggregationLevel aggregationLevel, QualitativeValue qualitativeValue, QualityFlag qualityFlag, PrecisionType precisionType, AnalysisInstrument analysisInstrument, Pmfm pmfm, Department department, NumericalPrecision numericalPrecision, Short subgroupNumber, Boolean isReferenceQuantification, Batch batch)
220        {
221            final QuantificationMeasurement entity = new QuantificationMeasurementImpl();
222            entity.setNumericalValue(numericalValue);
223            entity.setAlphanumericalValue(alphanumericalValue);
224            entity.setDigitCount(digitCount);
225            entity.setPrecisionValue(precisionValue);
226            entity.setControlDate(controlDate);
227            entity.setValidationDate(validationDate);
228            entity.setQualificationDate(qualificationDate);
229            entity.setQualificationComments(qualificationComments);
230            entity.setAggregationLevel(aggregationLevel);
231            entity.setQualitativeValue(qualitativeValue);
232            entity.setQualityFlag(qualityFlag);
233            entity.setPrecisionType(precisionType);
234            entity.setAnalysisInstrument(analysisInstrument);
235            entity.setPmfm(pmfm);
236            entity.setDepartment(department);
237            entity.setNumericalPrecision(numericalPrecision);
238            entity.setSubgroupNumber(subgroupNumber);
239            entity.setIsReferenceQuantification(isReferenceQuantification);
240            entity.setBatch(batch);
241            return entity;
242        }
243    }
244
245    /**
246     * @see Comparable#compareTo
247     */
248    public int compareTo(QuantificationMeasurement o)
249    {
250        int cmp = 0;
251        if (this.getId() != null)
252        {
253            cmp = this.getId().compareTo(o.getId());
254        }
255        else
256        {
257            if (this.getSubgroupNumber() != null)
258            {
259                cmp = (cmp != 0 ? cmp : this.getSubgroupNumber().compareTo(o.getSubgroupNumber()));
260            }
261            if (this.getIsReferenceQuantification() != null)
262            {
263                cmp = (cmp != 0 ? cmp : this.getIsReferenceQuantification().compareTo(o.getIsReferenceQuantification()));
264            }
265        }
266        return cmp;
267    }
268// HibernateEntity.vsl merge-point
269// QuantificationMeasurement.java merge-point
270}