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.administration.strategy;
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  import java.util.Date;
32  
33  /**
34   * Liste des périodes durant lesquels une stratégie est appliquée en un lieu.
35   */
36  // HibernateEntity.vsl annotations merge-point
37  public abstract class AppliedPeriod
38      implements Serializable, Comparable<AppliedPeriod>
39  {
40      /**
41       * The serial version UID of this class. Needed for serialization.
42       */
43      private static final long serialVersionUID = -4145217320950770178L;
44  
45      private AppliedPeriodPK appliedPeriodPk;
46  
47      /**
48       * Get the composite primary key identifier class
49       * @return appliedPeriodPk
50       */
51      public AppliedPeriodPK getAppliedPeriodPk()
52      {
53          return this.appliedPeriodPk;
54      }
55  
56      /**
57       * Set the composite primary key identifier class
58       * @param appliedPeriodPkIn
59       */
60      public void setAppliedPeriodPk(AppliedPeriodPK appliedPeriodPkIn) {
61          this.appliedPeriodPk = appliedPeriodPkIn;
62      }
63  
64      // Generate 3 attributes
65      /**
66       * Date de début de la période applicable
67       * @return this.appliedPeriodStartDt Date
68       */
69      public Date getAppliedPeriodStartDt()
70      {
71          return this.getAppliedPeriodPk().getAppliedPeriodStartDt();
72      }
73  
74      /**
75       * Date de début de la période applicable
76       * @param appliedPeriodStartDtIn Date
77       */
78      public void setAppliedPeriodStartDt(Date appliedPeriodStartDtIn)
79      {
80          this.getAppliedPeriodPk().setAppliedPeriodStartDt(appliedPeriodStartDtIn);
81      }
82  
83      private Date appliedPeriodEndDt;
84  
85      /**
86       * Date de fin de la période applicable. Si elle n'est pas définie, la période est en cours.
87       * @return this.appliedPeriodEndDt Date
88       */
89      public Date getAppliedPeriodEndDt()
90      {
91          return this.appliedPeriodEndDt;
92      }
93  
94      /**
95       * Date de fin de la période applicable. Si elle n'est pas définie, la période est en cours.
96       * @param appliedPeriodEndDtIn Date
97       */
98      public void setAppliedPeriodEndDt(Date appliedPeriodEndDtIn)
99      {
100         this.appliedPeriodEndDt = appliedPeriodEndDtIn;
101     }
102 
103     private Timestamp updateDt;
104 
105     /**
106      * Date de modification de l'objet, mise à jour par le système
107      * @return this.updateDt Timestamp
108      */
109     public Timestamp getUpdateDt()
110     {
111         return this.updateDt;
112     }
113 
114     /**
115      * Date de modification de l'objet, mise à jour par le système
116      * @param updateDtIn Timestamp
117      */
118     public void setUpdateDt(Timestamp updateDtIn)
119     {
120         this.updateDt = updateDtIn;
121     }
122 
123     // Generate 1 associations
124     private AppliedStrategy appliedStrategy;
125 
126     /**
127      * Identifie les conditions d'application locale de la stratégie pour une période donnée.
128      * @return this.appliedStrategy AppliedStrategy
129      */
130     public AppliedStrategy getAppliedStrategy()
131     {
132         return this.appliedStrategy;
133     }
134 
135     /**
136      * Identifie les conditions d'application locale de la stratégie pour une période donnée.
137      * @param appliedStrategyIn AppliedStrategy
138      */
139     public void setAppliedStrategy(AppliedStrategy appliedStrategyIn)
140     {
141         this.appliedStrategy = appliedStrategyIn;
142     }
143 
144     /**
145      * Returns <code>true</code> if the argument is an AppliedPeriod instance and all identifiers for this entity
146      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
147      */
148     @Override
149     public boolean equals(Object object)
150     {
151         if (this == object)
152         {
153             return true;
154         }
155         if (!(object instanceof AppliedPeriod))
156         {
157             return false;
158         }
159         final AppliedPeriod that = (AppliedPeriod)object;
160         if (this.appliedPeriodPk == null || that.appliedPeriodPk == null || !this.appliedPeriodPk.equals(that.appliedPeriodPk))
161         {
162             return false;
163         }
164         return true;
165     }
166 
167     /**
168      * Returns a hash code based on this entity's identifiers.
169      */
170     @Override
171     public int hashCode()
172     {
173         int hashCode = 0;
174         hashCode = 29 * hashCode + (this.appliedPeriodPk == null ? 0 : this.appliedPeriodPk.hashCode());
175 
176         return hashCode;
177     }
178 
179     /**
180      * Constructs new instances of {@link AppliedPeriod}.
181      */
182     public static final class Factory
183     {
184         /**
185          * Constructs a new instance of {@link AppliedPeriod}.
186          * @return new AppliedPeriodImpl()
187          */
188         public static AppliedPeriod newInstance()
189         {
190             return new AppliedPeriodImpl();
191         }
192 
193 
194         /**
195          * Constructs a new instance of {@link AppliedPeriod}, taking all possible properties
196          * (except the identifier(s))as arguments.
197          * @param appliedPeriodEndDt Date
198          * @param updateDt Timestamp
199          * @param appliedStrategy AppliedStrategy
200          * @return newInstance AppliedPeriod
201          */
202         public static AppliedPeriod newInstance(Date appliedPeriodEndDt, Timestamp updateDt, AppliedStrategy appliedStrategy)
203         {
204             final AppliedPeriod entity = new AppliedPeriodImpl();
205             entity.setAppliedPeriodEndDt(appliedPeriodEndDt);
206             entity.setUpdateDt(updateDt);
207             entity.setAppliedStrategy(appliedStrategy);
208             return entity;
209         }
210     }
211 
212     /**
213      * @see Comparable#compareTo
214      */
215     public int compareTo(AppliedPeriod o)
216     {
217         int cmp = 0;
218         if (this.getAppliedPeriodPk() != null)
219         {
220             cmp = this.getAppliedPeriodPk().compareTo(o.getAppliedPeriodPk());
221         }
222         else
223         {
224             if (this.getAppliedPeriodEndDt() != null)
225             {
226                 cmp = (cmp != 0 ? cmp : this.getAppliedPeriodEndDt().compareTo(o.getAppliedPeriodEndDt()));
227             }
228             if (this.getUpdateDt() != null)
229             {
230                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
231             }
232         }
233         return cmp;
234     }
235 // HibernateEntity.vsl merge-point
236 // AppliedPeriod.java merge-point
237 }