View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: Generated code! Do not modify by hand!
4   // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5   //
6   package fr.ifremer.quadrige2.core.dao.data.survey;
7   
8   /*-
9    * #%L
10   * Quadrige2 Core :: Server API
11   * %%
12   * Copyright (C) 2017 Ifremer
13   * %%
14   * This program is free software: you can redistribute it and/or modify
15   * it under the terms of the GNU Affero General Public License as published by
16   * the Free Software Foundation, either version 3 of the License, or
17   * (at your option) any later version.
18   * 
19   * This program is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22   * GNU General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Affero General Public License
25   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26   * #L%
27   */
28  
29  import java.io.Serializable;
30  import java.sql.Timestamp;
31  
32  /**
33   * Liste des navires intervenant dans les campagnes ou sorties Quadrige2.
34   */
35  // HibernateEntity.vsl annotations merge-point
36  public abstract class Ship
37      implements Serializable, Comparable<Ship>
38  {
39      /**
40       * The serial version UID of this class. Needed for serialization.
41       */
42      private static final long serialVersionUID = 8332936696997234082L;
43  
44      // Generate 4 attributes
45      private Integer shipId;
46  
47      /**
48       * Identifiant du navire
49       * @return this.shipId Integer
50       */
51      public Integer getShipId()
52      {
53          return this.shipId;
54      }
55  
56      /**
57       * Identifiant du navire
58       * @param shipIdIn Integer
59       */
60      public void setShipId(Integer shipIdIn)
61      {
62          this.shipId = shipIdIn;
63      }
64  
65      private String shipLb;
66  
67      /**
68       * Mnémonique du navire (qui sera repris du référentiel SISMER). La seule contrainte de ce
69       * mnémonique est d'être unique.
70       * @return this.shipLb String
71       */
72      public String getShipLb()
73      {
74          return this.shipLb;
75      }
76  
77      /**
78       * Mnémonique du navire (qui sera repris du référentiel SISMER). La seule contrainte de ce
79       * mnémonique est d'être unique.
80       * @param shipLbIn String
81       */
82      public void setShipLb(String shipLbIn)
83      {
84          this.shipLb = shipLbIn;
85      }
86  
87      private String shipNm;
88  
89      /**
90       * Libellé du navire
91       * @return this.shipNm String
92       */
93      public String getShipNm()
94      {
95          return this.shipNm;
96      }
97  
98      /**
99       * Libellé du navire
100      * @param shipNmIn String
101      */
102     public void setShipNm(String shipNmIn)
103     {
104         this.shipNm = shipNmIn;
105     }
106 
107     private Timestamp updateDt;
108 
109     /**
110      * Date de modification de l'objet, mise à jour par le système
111      * @return this.updateDt Timestamp
112      */
113     public Timestamp getUpdateDt()
114     {
115         return this.updateDt;
116     }
117 
118     /**
119      * Date de modification de l'objet, mise à jour par le système
120      * @param updateDtIn Timestamp
121      */
122     public void setUpdateDt(Timestamp updateDtIn)
123     {
124         this.updateDt = updateDtIn;
125     }
126 
127     // Generate 2 associations
128     /**
129      * Returns <code>true</code> if the argument is an Ship instance and all identifiers for this entity
130      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
131      */
132     @Override
133     public boolean equals(Object object)
134     {
135         if (this == object)
136         {
137             return true;
138         }
139         if (!(object instanceof Ship))
140         {
141             return false;
142         }
143         final Ship that = (Ship)object;
144         if (this.shipId == null || that.getShipId() == null || !this.shipId.equals(that.getShipId()))
145         {
146             return false;
147         }
148         return true;
149     }
150 
151     /**
152      * Returns a hash code based on this entity's identifiers.
153      */
154     @Override
155     public int hashCode()
156     {
157         int hashCode = 0;
158         hashCode = 29 * hashCode + (this.shipId == null ? 0 : this.shipId.hashCode());
159 
160         return hashCode;
161     }
162 
163     /**
164      * Constructs new instances of {@link Ship}.
165      */
166     public static final class Factory
167     {
168         /**
169          * Constructs a new instance of {@link Ship}.
170          * @return new ShipImpl()
171          */
172         public static Ship newInstance()
173         {
174             return new ShipImpl();
175         }
176 
177 
178         /**
179          * Constructs a new instance of {@link Ship}, taking all possible properties
180          * (except the identifier(s))as arguments.
181          * @param shipLb String
182          * @param shipNm String
183          * @param updateDt Timestamp
184          * @return newInstance Ship
185          */
186         public static Ship newInstance(String shipLb, String shipNm, Timestamp updateDt)
187         {
188             final Ship entity = new ShipImpl();
189             entity.setShipLb(shipLb);
190             entity.setShipNm(shipNm);
191             entity.setUpdateDt(updateDt);
192             return entity;
193         }
194     }
195 
196     /**
197      * @see Comparable#compareTo
198      */
199     public int compareTo(Ship o)
200     {
201         int cmp = 0;
202         if (this.getShipId() != null)
203         {
204             cmp = this.getShipId().compareTo(o.getShipId());
205         }
206         else
207         {
208             if (this.getShipLb() != null)
209             {
210                 cmp = (cmp != 0 ? cmp : this.getShipLb().compareTo(o.getShipLb()));
211             }
212             if (this.getShipNm() != null)
213             {
214                 cmp = (cmp != 0 ? cmp : this.getShipNm().compareTo(o.getShipNm()));
215             }
216             if (this.getUpdateDt() != null)
217             {
218                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
219             }
220         }
221         return cmp;
222     }
223 // HibernateEntity.vsl merge-point
224 // Ship.java merge-point
225 }