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.buyer;
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.Status;
032import java.io.Serializable;
033import java.sql.Timestamp;
034
035/**
036 * 
037 */
038// HibernateEntity.vsl annotations merge-point
039public abstract class Buyer
040    implements Serializable, Comparable<Buyer>
041{
042    /**
043     * The serial version UID of this class. Needed for serialization.
044     */
045    private static final long serialVersionUID = -659466554238281412L;
046
047    // Generate 8 attributes
048    private Integer id;
049
050    /**
051     * Identifiant interne de l'acheteur. Généré par le système.
052     * @return this.id Integer
053     */
054    public Integer getId()
055    {
056        return this.id;
057    }
058
059    /**
060     * Identifiant interne de l'acheteur. Généré par le système.
061     * @param idIn Integer
062     */
063    public void setId(Integer idIn)
064    {
065        this.id = idIn;
066    }
067
068    private String registrationCode;
069
070    /**
071     * Code de l'acheteur. Par exemple : Numéro de Siret
072     * @return this.registrationCode String
073     */
074    public String getRegistrationCode()
075    {
076        return this.registrationCode;
077    }
078
079    /**
080     * Code de l'acheteur. Par exemple : Numéro de Siret
081     * @param registrationCodeIn String
082     */
083    public void setRegistrationCode(String registrationCodeIn)
084    {
085        this.registrationCode = registrationCodeIn;
086    }
087
088    private String name;
089
090    /**
091     * Nom de l'acheteur. Généraloement, le nom de l'entreprise.
092     * @return this.name String
093     */
094    public String getName()
095    {
096        return this.name;
097    }
098
099    /**
100     * Nom de l'acheteur. Généraloement, le nom de l'entreprise.
101     * @param nameIn String
102     */
103    public void setName(String nameIn)
104    {
105        this.name = nameIn;
106    }
107
108    private String street;
109
110    /**
111     * 
112     * @return this.street String
113     */
114    public String getStreet()
115    {
116        return this.street;
117    }
118
119    /**
120     * 
121     * @param streetIn String
122     */
123    public void setStreet(String streetIn)
124    {
125        this.street = streetIn;
126    }
127
128    private String zipCode;
129
130    /**
131     * 
132     * @return this.zipCode String
133     */
134    public String getZipCode()
135    {
136        return this.zipCode;
137    }
138
139    /**
140     * 
141     * @param zipCodeIn String
142     */
143    public void setZipCode(String zipCodeIn)
144    {
145        this.zipCode = zipCodeIn;
146    }
147
148    private String city;
149
150    /**
151     * 
152     * @return this.city String
153     */
154    public String getCity()
155    {
156        return this.city;
157    }
158
159    /**
160     * 
161     * @param cityIn String
162     */
163    public void setCity(String cityIn)
164    {
165        this.city = cityIn;
166    }
167
168    private String address;
169
170    /**
171     * Adresse de l'acheteur (calculé à partir de street, zipCode et city)
172     * @return this.address String
173     */
174    public String getAddress()
175    {
176        return this.address;
177    }
178
179    /**
180     * Adresse de l'acheteur (calculé à partir de street, zipCode et city)
181     * @param addressIn String
182     */
183    public void setAddress(String addressIn)
184    {
185        this.address = addressIn;
186    }
187
188    private Timestamp updateDate;
189
190    /**
191     * 
192     * @return this.updateDate Timestamp
193     */
194    public Timestamp getUpdateDate()
195    {
196        return this.updateDate;
197    }
198
199    /**
200     * 
201     * @param updateDateIn Timestamp
202     */
203    public void setUpdateDate(Timestamp updateDateIn)
204    {
205        this.updateDate = updateDateIn;
206    }
207
208    // Generate 3 associations
209    private BuyerType buyerType;
210
211    /**
212     * 
213     * @return this.buyerType BuyerType
214     */
215    public BuyerType getBuyerType()
216    {
217        return this.buyerType;
218    }
219
220    /**
221     * 
222     * @param buyerTypeIn BuyerType
223     */
224    public void setBuyerType(BuyerType buyerTypeIn)
225    {
226        this.buyerType = buyerTypeIn;
227    }
228
229    private Status status;
230
231    /**
232     * Pour les données du référentiel, information permettant de déterminer si une donnée est
233     * valide,
234     * obsolète ou temporaire.
235     * - obsolète (=inactif) : '0'
236     * - valide (=actif) : '1'
237     * - temporaire : '2'
238     * - en cours de suppression : '3'
239     * -  : '4'
240     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
241     * confondre
242     * avec par exemple l'activité d'un navire sur un mois.
243     * @return this.status Status
244     */
245    public Status getStatus()
246    {
247        return this.status;
248    }
249
250    /**
251     * Pour les données du référentiel, information permettant de déterminer si une donnée est
252     * valide,
253     * obsolète ou temporaire.
254     * - obsolète (=inactif) : '0'
255     * - valide (=actif) : '1'
256     * - temporaire : '2'
257     * - en cours de suppression : '3'
258     * -  : '4'
259     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
260     * confondre
261     * avec par exemple l'activité d'un navire sur un mois.
262     * @param statusIn Status
263     */
264    public void setStatus(Status statusIn)
265    {
266        this.status = statusIn;
267    }
268
269    /**
270     * Returns <code>true</code> if the argument is an Buyer instance and all identifiers for this entity
271     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
272     */
273    @Override
274    public boolean equals(Object object)
275    {
276        if (this == object)
277        {
278            return true;
279        }
280        if (!(object instanceof Buyer))
281        {
282            return false;
283        }
284        final Buyer that = (Buyer)object;
285        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
286        {
287            return false;
288        }
289        return true;
290    }
291
292    /**
293     * Returns a hash code based on this entity's identifiers.
294     */
295    @Override
296    public int hashCode()
297    {
298        int hashCode = 0;
299        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
300
301        return hashCode;
302    }
303
304    /**
305     * Constructs new instances of {@link Buyer}.
306     */
307    public static final class Factory
308    {
309        /**
310         * Constructs a new instance of {@link Buyer}.
311         * @return new BuyerImpl()
312         */
313        public static Buyer newInstance()
314        {
315            return new BuyerImpl();
316        }
317
318        /**
319         * Constructs a new instance of {@link Buyer}, taking all required and/or
320         * read-only properties as arguments, except for identifiers.
321         * @param updateDate Timestamp
322         * @param buyerType BuyerType
323         * @param status Status
324         * @return newInstance
325         */
326        public static Buyer newInstance(Timestamp updateDate, BuyerType buyerType, Status status)
327        {
328            final Buyer entity = new BuyerImpl();
329            entity.setUpdateDate(updateDate);
330            entity.setBuyerType(buyerType);
331            entity.setStatus(status);
332            return entity;
333        }
334
335        /**
336         * Constructs a new instance of {@link Buyer}, taking all possible properties
337         * (except the identifier(s))as arguments.
338         * @param registrationCode String
339         * @param name String
340         * @param street String
341         * @param zipCode String
342         * @param city String
343         * @param address String
344         * @param updateDate Timestamp
345         * @param buyerType BuyerType
346         * @param status Status
347         * @return newInstance Buyer
348         */
349        public static Buyer newInstance(String registrationCode, String name, String street, String zipCode, String city, String address, Timestamp updateDate, BuyerType buyerType, Status status)
350        {
351            final Buyer entity = new BuyerImpl();
352            entity.setRegistrationCode(registrationCode);
353            entity.setName(name);
354            entity.setStreet(street);
355            entity.setZipCode(zipCode);
356            entity.setCity(city);
357            entity.setAddress(address);
358            entity.setUpdateDate(updateDate);
359            entity.setBuyerType(buyerType);
360            entity.setStatus(status);
361            return entity;
362        }
363    }
364
365    /**
366     * @see Comparable#compareTo
367     */
368    public int compareTo(Buyer o)
369    {
370        int cmp = 0;
371        if (this.getId() != null)
372        {
373            cmp = this.getId().compareTo(o.getId());
374        }
375        else
376        {
377            if (this.getRegistrationCode() != null)
378            {
379                cmp = (cmp != 0 ? cmp : this.getRegistrationCode().compareTo(o.getRegistrationCode()));
380            }
381            if (this.getName() != null)
382            {
383                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
384            }
385            if (this.getStreet() != null)
386            {
387                cmp = (cmp != 0 ? cmp : this.getStreet().compareTo(o.getStreet()));
388            }
389            if (this.getZipCode() != null)
390            {
391                cmp = (cmp != 0 ? cmp : this.getZipCode().compareTo(o.getZipCode()));
392            }
393            if (this.getCity() != null)
394            {
395                cmp = (cmp != 0 ? cmp : this.getCity().compareTo(o.getCity()));
396            }
397            if (this.getAddress() != null)
398            {
399                cmp = (cmp != 0 ? cmp : this.getAddress().compareTo(o.getAddress()));
400            }
401            if (this.getUpdateDate() != null)
402            {
403                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
404            }
405        }
406        return cmp;
407    }
408// HibernateEntity.vsl merge-point
409// Buyer.java merge-point
410}