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