1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.formengine.business;
35
36 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
37 import fr.paris.lutece.util.date.DateUtil;
38
39 import java.sql.Timestamp;
40
41 import java.util.Calendar;
42 import java.util.Date;
43
44
45
46
47
48 public class Notice implements AdminWorkgroupResource
49 {
50 private int _nIdNotice;
51 private String _strTitle;
52 private String _strMessage;
53 private String _strWorkgroupKey;
54 private Timestamp _tDateDebut;
55 private Timestamp _tDateFin;
56 private int _nIdDiffusion;
57 private int _nIdNoticeGroup;
58 private int _nOrder;
59 private boolean _bIsEnabled;
60
61
62 private int _nIdNotification;
63
64
65
66
67
68 public int getIdNotice( )
69 {
70 return _nIdNotice;
71 }
72
73
74
75
76
77 public void setIdNotice( int idNotice )
78 {
79 _nIdNotice = idNotice;
80 }
81
82
83
84
85
86 public String getTitle( )
87 {
88 return _strTitle;
89 }
90
91
92
93
94
95 public void setTitle( String title )
96 {
97 _strTitle = title;
98 }
99
100
101
102
103
104 public String getMessage( )
105 {
106 return _strMessage;
107 }
108
109
110
111
112
113 public void setMessage( String message )
114 {
115 _strMessage = message;
116 }
117
118
119
120
121
122 public String getWorkgroupKey( )
123 {
124 return _strWorkgroupKey;
125 }
126
127
128
129
130
131 public void setWorkgroupKey( String workgroupKey )
132 {
133 _strWorkgroupKey = workgroupKey;
134 }
135
136
137
138
139
140 public Timestamp getDateDebut( )
141 {
142 return _tDateDebut;
143 }
144
145
146
147
148
149 public void setDateDebut( Timestamp dateDebut )
150 {
151 _tDateDebut = dateDebut;
152 }
153
154
155
156
157
158 public Timestamp getDateFin( )
159 {
160 return _tDateFin;
161 }
162
163
164
165
166
167 public void setDateFin( Timestamp dateFin )
168 {
169 _tDateFin = dateFin;
170 }
171
172
173
174
175
176 public int getIdDiffusion( )
177 {
178 return _nIdDiffusion;
179 }
180
181
182
183
184
185 public void setIdDiffusion( int idDiffusion )
186 {
187 _nIdDiffusion = idDiffusion;
188 }
189
190
191
192
193
194 public boolean isEnabled( )
195 {
196 return _bIsEnabled;
197 }
198
199
200
201
202
203 public void setEnabled( boolean enable )
204 {
205 _bIsEnabled = enable;
206 }
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232 public String getWorkgroup( )
233 {
234 return _strWorkgroupKey;
235 }
236
237
238
239
240
241 public int getIdNotification( )
242 {
243 return _nIdNotification;
244 }
245
246
247
248
249
250 public void setIdNotification( int idNotification )
251 {
252 _nIdNotification = idNotification;
253 }
254
255
256
257
258
259 public boolean hasValidDate( )
260 {
261 Date dateDebut = getDateDebut( );
262 Date dateFin = getDateFin( );
263 Date dateDuJour = new Date( );
264
265 Calendar cal = Calendar.getInstance( );
266 cal.setTime( dateDuJour );
267 cal.set( Calendar.MINUTE, 0 );
268 cal.set( Calendar.HOUR, 0 );
269 cal.set( Calendar.SECOND, 0 );
270
271 dateDuJour = cal.getTime( );
272
273 if ( dateDebut == null )
274 {
275 dateDebut = dateDuJour;
276 }
277 else
278 {
279 cal.setTime( dateDebut );
280 cal.set( Calendar.MINUTE, 0 );
281 cal.set( Calendar.HOUR, 0 );
282 cal.set( Calendar.SECOND, 0 );
283
284 dateDebut = cal.getTime( );
285 }
286
287 if ( dateFin != null )
288 {
289 cal.setTime( dateFin );
290 cal.set( Calendar.MINUTE, 0 );
291 cal.set( Calendar.HOUR, 0 );
292 cal.set( Calendar.SECOND, 0 );
293
294 dateFin = cal.getTime( );
295
296
297 if ( DateUtil.getDateString( dateDebut ).equals( DateUtil.getDateString( dateFin ) ) &&
298 DateUtil.getDateString( dateDebut ).equals( DateUtil.getDateString( dateDuJour ) ) )
299 {
300 return true;
301 }
302
303 if ( dateDebut.after( dateDuJour ) || dateFin.before( dateDuJour ) )
304 {
305 return false;
306 }
307 }
308 else
309 {
310 if ( dateDebut.after( dateDuJour ) )
311 {
312 return false;
313 }
314 }
315
316 return true;
317 }
318
319
320
321
322
323 public int getIdNoticeGroup( )
324 {
325 return _nIdNoticeGroup;
326 }
327
328
329
330
331
332 public void setIdNoticeGroup( int nIdNoticeGroup )
333 {
334 _nIdNoticeGroup = nIdNoticeGroup;
335 }
336
337
338
339
340
341 public int getOrder( )
342 {
343 return _nOrder;
344 }
345
346
347
348
349
350 public void setOrder( int nOrder )
351 {
352 _nOrder = nOrder;
353 }
354 }