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.location;
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 java.io.Serializable;
032import java.sql.Timestamp;
033
034/**
035 * Représente une association entre un lieu parent et un lieu fils.
036 */
037// HibernateEntity.vsl annotations merge-point
038public abstract class LocationAssociation
039    implements Serializable, Comparable<LocationAssociation>
040{
041    /**
042     * The serial version UID of this class. Needed for serialization.
043     */
044    private static final long serialVersionUID = 6358749952819942603L;
045
046    private LocationAssociationPK locationAssociationPk;
047
048    /**
049     * Get the composite primary key identifier class
050     * @return locationAssociationPk
051     */
052    public LocationAssociationPK getLocationAssociationPk()
053    {
054        return this.locationAssociationPk;
055    }
056
057    /**
058     * Set the composite primary key identifier class
059     * @param locationAssociationPkIn
060     */
061    public void setLocationAssociationPk(LocationAssociationPK locationAssociationPkIn) {
062        this.locationAssociationPk = locationAssociationPkIn;
063    }
064
065    // Generate 2 attributes
066    private Float childSurfaceRatio = Float.valueOf("1.0");
067
068    /**
069     * Ratio de couverture (en surface) du lieu fils par rapport au lieu père. La valeur doit etre
070     * supérieure strictement à 0 et inférieur ou égale à 1.
071     * Un Lieu qui a un ratio de surface de 1 n'a donc qu'un seul lieu père direct. Un lieu qui a un
072     * ratio de surface inférieur à 1 peu avoir potentiellement plusieurs lieux pères directs.
073     * @return this.childSurfaceRatio Float
074     */
075    public Float getChildSurfaceRatio()
076    {
077        return this.childSurfaceRatio;
078    }
079
080    /**
081     * Ratio de couverture (en surface) du lieu fils par rapport au lieu père. La valeur doit etre
082     * supérieure strictement à 0 et inférieur ou égale à 1.
083     * Un Lieu qui a un ratio de surface de 1 n'a donc qu'un seul lieu père direct. Un lieu qui a un
084     * ratio de surface inférieur à 1 peu avoir potentiellement plusieurs lieux pères directs.
085     * @param childSurfaceRatioIn Float
086     */
087    public void setChildSurfaceRatio(Float childSurfaceRatioIn)
088    {
089        this.childSurfaceRatio = childSurfaceRatioIn;
090    }
091
092    private Timestamp updateDate;
093
094    /**
095     * 
096     * @return this.updateDate Timestamp
097     */
098    public Timestamp getUpdateDate()
099    {
100        return this.updateDate;
101    }
102
103    /**
104     * 
105     * @param updateDateIn Timestamp
106     */
107    public void setUpdateDate(Timestamp updateDateIn)
108    {
109        this.updateDate = updateDateIn;
110    }
111
112    // Generate 2 associations
113    private Location parentLocation;
114
115    /**
116     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
117     * surfacique.
118     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
119     * un
120     * quartier maritime, une criée, etc.
121     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
122     * 200
123     * @return this.parentLocation Location
124     */
125    public Location getParentLocation()
126    {
127        return this.parentLocation;
128    }
129
130    /**
131     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
132     * surfacique.
133     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
134     * un
135     * quartier maritime, une criée, etc.
136     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
137     * 200
138     * @param parentLocationIn Location
139     */
140    public void setParentLocation(Location parentLocationIn)
141    {
142        this.parentLocation = parentLocationIn;
143    }
144
145    private Location childLocation;
146
147    /**
148     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
149     * surfacique.
150     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
151     * un
152     * quartier maritime, une criée, etc.
153     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
154     * 200
155     * @return this.childLocation Location
156     */
157    public Location getChildLocation()
158    {
159        return this.childLocation;
160    }
161
162    /**
163     * Représente un lieu au sens général du terme. Il peut s'agir d'un lieu ponctuel, linéaire ou
164     * surfacique.
165     * Suivant sa classification et son niveau, il peut s'agir d'un secteur FAO, un port de pêche,
166     * un
167     * quartier maritime, une criée, etc.
168     * Nombre de lignes : lieux terrestre : 4500 + secteurs : 11210 + strates : 1000 + localités :
169     * 200
170     * @param childLocationIn Location
171     */
172    public void setChildLocation(Location childLocationIn)
173    {
174        this.childLocation = childLocationIn;
175    }
176
177    /**
178     * This entity does not have any identifiers
179     * and is not extending any other entity,
180     * so this method will only return <code>true</code> if the argument reference and <code>this</code>
181     * refer to the same object.
182     */
183    @Override
184    public boolean equals(Object object)
185    {
186        return super.equals(object);
187    }
188
189    /**
190     * This entity does not have any identifiers
191     * and is not extending any other entity,
192     * so this method will only take the identifiers of this entity into account when calculating the hash code.
193     */
194    @Override
195    public int hashCode()
196    {
197        return super.hashCode();
198    }
199
200    /**
201     * Constructs new instances of {@link LocationAssociation}.
202     */
203    public static final class Factory
204    {
205        /**
206         * Constructs a new instance of {@link LocationAssociation}.
207         * @return new LocationAssociationImpl()
208         */
209        public static LocationAssociation newInstance()
210        {
211            return new LocationAssociationImpl();
212        }
213
214
215        /**
216         * Constructs a new instance of {@link LocationAssociation}, taking all possible properties
217         * (except the identifier(s))as arguments.
218         * @param childSurfaceRatio Float
219         * @param updateDate Timestamp
220         * @param parentLocation Location
221         * @param childLocation Location
222         * @return newInstance LocationAssociation
223         */
224        public static LocationAssociation newInstance(Float childSurfaceRatio, Timestamp updateDate, Location parentLocation, Location childLocation)
225        {
226            final LocationAssociation entity = new LocationAssociationImpl();
227            entity.setChildSurfaceRatio(childSurfaceRatio);
228            entity.setUpdateDate(updateDate);
229            entity.setParentLocation(parentLocation);
230            entity.setChildLocation(childLocation);
231            return entity;
232        }
233    }
234
235    /**
236     * @see Comparable#compareTo
237     */
238    public int compareTo(LocationAssociation o)
239    {
240        int cmp = 0;
241        if (this.getLocationAssociationPk() != null)
242        {
243            cmp = this.getLocationAssociationPk().compareTo(o.getLocationAssociationPk());
244        }
245            if (this.getChildSurfaceRatio() != null)
246            {
247                cmp = (cmp != 0 ? cmp : this.getChildSurfaceRatio().compareTo(o.getChildSurfaceRatio()));
248            }
249            if (this.getUpdateDate() != null)
250            {
251                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
252            }
253        return cmp;
254    }
255// HibernateEntity.vsl merge-point
256// LocationAssociation.java merge-point
257}