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;
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 * Pour les données du référentiel, information permettant de déterminer si une donnée est valide,
036 * obsolète ou temporaire.
037 * - obsolète (=inactif) : '0'
038 * - valide (=actif) : '1'
039 * - temporaire : '2'
040 * - en cours de suppression : '3'
041 * -  : '4'
042 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas confondre
043 * avec par exemple l'activité d'un navire sur un mois.
044 */
045// HibernateEntity.vsl annotations merge-point
046public abstract class Status
047    implements Serializable, Comparable<Status>
048{
049    /**
050     * The serial version UID of this class. Needed for serialization.
051     */
052    private static final long serialVersionUID = 1108748994893207779L;
053
054    // Generate 3 attributes
055    private String code;
056
057    /**
058     * 
059     * @return this.code String
060     */
061    public String getCode()
062    {
063        return this.code;
064    }
065
066    /**
067     * 
068     * @param codeIn String
069     */
070    public void setCode(String codeIn)
071    {
072        this.code = codeIn;
073    }
074
075    private String name;
076
077    /**
078     * 
079     * @return this.name String
080     */
081    public String getName()
082    {
083        return this.name;
084    }
085
086    /**
087     * 
088     * @param nameIn String
089     */
090    public void setName(String nameIn)
091    {
092        this.name = nameIn;
093    }
094
095    private Timestamp updateDate;
096
097    /**
098     * 
099     * @return this.updateDate Timestamp
100     */
101    public Timestamp getUpdateDate()
102    {
103        return this.updateDate;
104    }
105
106    /**
107     * 
108     * @param updateDateIn Timestamp
109     */
110    public void setUpdateDate(Timestamp updateDateIn)
111    {
112        this.updateDate = updateDateIn;
113    }
114
115    // Generate 46 associations
116    /**
117     * Returns <code>true</code> if the argument is an Status instance and all identifiers for this entity
118     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
119     */
120    @Override
121    public boolean equals(Object object)
122    {
123        if (this == object)
124        {
125            return true;
126        }
127        if (!(object instanceof Status))
128        {
129            return false;
130        }
131        final Status that = (Status)object;
132        if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode()))
133        {
134            return false;
135        }
136        return true;
137    }
138
139    /**
140     * Returns a hash code based on this entity's identifiers.
141     */
142    @Override
143    public int hashCode()
144    {
145        int hashCode = 0;
146        hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode());
147
148        return hashCode;
149    }
150
151    /**
152     * Constructs new instances of {@link Status}.
153     */
154    public static final class Factory
155    {
156        /**
157         * Constructs a new instance of {@link Status}.
158         * @return new StatusImpl()
159         */
160        public static Status newInstance()
161        {
162            return new StatusImpl();
163        }
164
165
166        /**
167         * Constructs a new instance of {@link Status}, taking all possible properties
168         * (except the identifier(s))as arguments.
169         * @param name String
170         * @param updateDate Timestamp
171         * @return newInstance Status
172         */
173        public static Status newInstance(String name, Timestamp updateDate)
174        {
175            final Status entity = new StatusImpl();
176            entity.setName(name);
177            entity.setUpdateDate(updateDate);
178            return entity;
179        }
180    }
181
182    /**
183     * @see Comparable#compareTo
184     */
185    public int compareTo(Status o)
186    {
187        int cmp = 0;
188        if (this.getCode() != null)
189        {
190            cmp = this.getCode().compareTo(o.getCode());
191        }
192        else
193        {
194            if (this.getName() != null)
195            {
196                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
197            }
198            if (this.getUpdateDate() != null)
199            {
200                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
201            }
202        }
203        return cmp;
204    }
205// HibernateEntity.vsl merge-point
206// Status.java merge-point
207}