View Javadoc
1   /*
2    * Copyright (c) 2002-2024, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.identitystore.business.contract;
35  
36  import javax.validation.constraints.NotEmpty;
37  import javax.validation.constraints.Size;
38  import java.io.Serializable;
39  import java.sql.Date;
40  import java.sql.Timestamp;
41  import java.time.Instant;
42  import java.util.ArrayList;
43  import java.util.List;
44  
45  /**
46   * This is the business class for the object ServiceContract
47   */
48  public class ServiceContract implements Serializable
49  {
50      private static final long serialVersionUID = 1L;
51  
52      // Variables declarations
53      private int _nId;
54  
55      private String _strClientCode;
56  
57      @NotEmpty( message = "#i18n{contractservice.validation.servicecontract.Name.notEmpty}" )
58      @Size( max = 50, message = "#i18n{contractservice.validation.servicecontract.Name.size}" )
59      private String _strName;
60  
61      @NotEmpty( message = "#i18n{contractservice.validation.servicecontract.OrganizationalEntity.notEmpty}" )
62      @Size( max = 50, message = "#i18n{contractservice.validation.servicecontract.OrganizationalEntity.size}" )
63      private String _strMoaEntityName;
64  
65      private String _strMoeEntityName;
66  
67      @NotEmpty( message = "#i18n{contractservice.validation.servicecontract.ResponsibleName.notEmpty}" )
68      @Size( max = 50, message = "#i18n{contractservice.validation.servicecontract.ResponsibleName.size}" )
69      private String _strMoeResponsibleName;
70  
71      @NotEmpty( message = "#i18n{contractservice.validation.servicecontract.ContactName.notEmpty}" )
72      @Size( max = 50, message = "#i18n{contractservice.validation.servicecontract.ContactName.size}" )
73      private String _strMoaContactName;
74  
75      @NotEmpty( message = "#i18n{contractservice.validation.servicecontract.ServiceType.notEmpty}" )
76      @Size( max = 50, message = "#i18n{contractservice.validation.servicecontract.ServiceType.size}" )
77      private String _strServiceType;
78  
79      private Date _dateStartingDate;
80      private Date _dateEndingDate;
81  
82      private boolean _bAuthorizedCreation;
83  
84      private boolean _bAuthorizedUpdate;
85  
86      private boolean _bAuthorizedMerge;
87  
88      private boolean _bAuthorizedAccountUpdate;
89  
90      private boolean _bAuthorizedDeletion;
91  
92      private boolean _bAuthorizedImport;
93  
94      private boolean _bAuthorizedExport;
95  
96      private boolean _bAuthorizedSearch;
97  
98      private boolean _bAuthorizedDecertification;
99  
100     private boolean _bAuthorizedAgentHistoryRead;
101 
102     private int _nDataRetentionPeriodInMonths;
103 
104     private List<AttributeRight> _listAttributeRights = new ArrayList<>( );
105 
106     private List<AttributeCertification> _listAttributeCertifications = new ArrayList<>( );
107 
108     private List<AttributeRequirement> _listAttributeRequirements = new ArrayList<>( );
109 
110     public boolean isActive( )
111     {
112         final Timestamp actualTimestamp = Timestamp.from( Instant.now( ) );
113         return ( this.getStartingDate( ).before( actualTimestamp ) && ( this.getEndingDate( ) == null || this.getEndingDate( ).after( actualTimestamp ) ) );
114     }
115 
116     /**
117      * Returns the Id
118      * 
119      * @return The Id
120      */
121     public int getId( )
122     {
123         return _nId;
124     }
125 
126     /**
127      * Sets the Id
128      * 
129      * @param nId
130      *            The Id
131      */
132     public void setId( int nId )
133     {
134         _nId = nId;
135     }
136 
137     public String getClientCode( )
138     {
139         return _strClientCode;
140     }
141 
142     public void setClientCode( String _strClientCode )
143     {
144         this._strClientCode = _strClientCode;
145     }
146 
147     /**
148      * Returns the Name
149      * 
150      * @return The Name
151      */
152     public String getName( )
153     {
154         return _strName;
155     }
156 
157     /**
158      * Sets the Name
159      * 
160      * @param strName
161      *            The Name
162      */
163     public void setName( String strName )
164     {
165         _strName = strName;
166     }
167 
168     /**
169      * Returns the name of the MOA entity
170      * 
171      * @return The name of the MOA entity
172      */
173     public String getMoaEntityName( )
174     {
175         return _strMoaEntityName;
176     }
177 
178     /**
179      * Sets the name of the MOA entity
180      * 
181      * @param strMoaEntityName
182      *            The name of the MOA entity
183      */
184     public void setMoaEntityName( String strMoaEntityName )
185     {
186         _strMoaEntityName = strMoaEntityName;
187     }
188 
189     public String getMoeEntityName( )
190     {
191         return _strMoeEntityName;
192     }
193 
194     public void setMoeEntityName( String _strMoeEntityName )
195     {
196         this._strMoeEntityName = _strMoeEntityName;
197     }
198 
199     /**
200      * Returns the name of the MOE responsible
201      * 
202      * @return The name of the MOE responsible
203      */
204     public String getMoeResponsibleName( )
205     {
206         return _strMoeResponsibleName;
207     }
208 
209     /**
210      * Sets the name of the MOE responsible
211      * 
212      * @param strMoeResponsibleName
213      *            The name of the MOE responsible
214      */
215     public void setMoeResponsibleName( String strMoeResponsibleName )
216     {
217         _strMoeResponsibleName = strMoeResponsibleName;
218     }
219 
220     /**
221      * Returns the name of the MOA contact
222      * 
223      * @return The name of the MOA contact
224      */
225     public String getMoaContactName( )
226     {
227         return _strMoaContactName;
228     }
229 
230     /**
231      * Sets the name of the MOA contact
232      * 
233      * @param strMoaContactName
234      *            The name of the MOA contact
235      */
236     public void setMoaContactName( String strMoaContactName )
237     {
238         _strMoaContactName = strMoaContactName;
239     }
240 
241     /**
242      * Returns the ServiceType
243      * 
244      * @return The ServiceType
245      */
246     public String getServiceType( )
247     {
248         return _strServiceType;
249     }
250 
251     /**
252      * Sets the ServiceType
253      * 
254      * @param strServiceType
255      *            The ServiceType
256      */
257     public void setServiceType( String strServiceType )
258     {
259         _strServiceType = strServiceType;
260     }
261 
262     public Date getStartingDate( )
263     {
264         return _dateStartingDate;
265     }
266 
267     public void setStartingDate( Date _dateStartingDate )
268     {
269         this._dateStartingDate = _dateStartingDate;
270     }
271 
272     public Date getEndingDate( )
273     {
274         return _dateEndingDate;
275     }
276 
277     public void setEndingDate( Date _dateEndingDate )
278     {
279         this._dateEndingDate = _dateEndingDate;
280     }
281 
282     public boolean getAuthorizedCreation( )
283     {
284         return _bAuthorizedCreation;
285     }
286 
287     public void setAuthorizedCreation( boolean _bAuthorizedCreation )
288     {
289         this._bAuthorizedCreation = _bAuthorizedCreation;
290     }
291 
292     public boolean getAuthorizedUpdate( )
293     {
294         return _bAuthorizedUpdate;
295     }
296 
297     public void setAuthorizedUpdate( boolean _bAuthorizedUpdate )
298     {
299         this._bAuthorizedUpdate = _bAuthorizedUpdate;
300     }
301 
302     public boolean getAuthorizedSearch( )
303     {
304         return _bAuthorizedSearch;
305     }
306 
307     public void setAuthorizedSearch( boolean _bAuthorizedSearch )
308     {
309         this._bAuthorizedSearch = _bAuthorizedSearch;
310     }
311 
312     /**
313      * Returns the AuthorizedMerge
314      * 
315      * @return The AuthorizedMerge
316      */
317     public boolean getAuthorizedMerge( )
318     {
319         return _bAuthorizedMerge;
320     }
321 
322     /**
323      * Sets the AuthorizedMerge
324      * 
325      * @param bAuthorizedMerge
326      *            The AuthorizedMerge
327      */
328     public void setAuthorizedMerge( boolean bAuthorizedMerge )
329     {
330         _bAuthorizedMerge = bAuthorizedMerge;
331     }
332 
333     /**
334      * Returns the AuthorizedAccountUpdate
335      *
336      * @return The AuthorizedAccountUpdate
337      */
338     public boolean getAuthorizedAccountUpdate( )
339     {
340         return _bAuthorizedAccountUpdate;
341     }
342 
343     /**
344      * Sets the AuthorizedMerge
345      *
346      * @param bAuthorizedAccountUpdate
347      *            The AuthorizedAccountUpdate
348      */
349     public void setAuthorizedAccountUpdate( boolean bAuthorizedAccountUpdate )
350     {
351         _bAuthorizedAccountUpdate = bAuthorizedAccountUpdate;
352     }
353 
354     /**
355      * Returns the AuthorizedDeletion
356      * 
357      * @return The AuthorizedDeletion
358      */
359     public boolean getAuthorizedDeletion( )
360     {
361         return _bAuthorizedDeletion;
362     }
363 
364     /**
365      * Sets the AuthorizedDeletion
366      * 
367      * @param bAuthorizedDeletion
368      *            The AuthorizedDeletion
369      */
370     public void setAuthorizedDeletion( boolean bAuthorizedDeletion )
371     {
372         _bAuthorizedDeletion = bAuthorizedDeletion;
373     }
374 
375     /**
376      * Returns the AuthorizedImport
377      * 
378      * @return The AuthorizedImport
379      */
380     public boolean getAuthorizedImport( )
381     {
382         return _bAuthorizedImport;
383     }
384 
385     /**
386      * Sets the AuthorizedImport
387      * 
388      * @param bAuthorizedImport
389      *            The AuthorizedImport
390      */
391     public void setAuthorizedImport( boolean bAuthorizedImport )
392     {
393         _bAuthorizedImport = bAuthorizedImport;
394     }
395 
396     /**
397      * Returns the AuthorizedExport
398      * 
399      * @return The AuthorizedExport
400      */
401     public boolean getAuthorizedExport( )
402     {
403         return _bAuthorizedExport;
404     }
405 
406     /**
407      * Sets the AuthorizedExport
408      * 
409      * @param bAuthorizedExport
410      *            The AuthorizedExport
411      */
412     public void setAuthorizedExport( boolean bAuthorizedExport )
413     {
414         _bAuthorizedExport = bAuthorizedExport;
415     }
416 
417     public boolean getAuthorizedDecertification( )
418     {
419         return _bAuthorizedDecertification;
420     }
421 
422     public void setAuthorizedDecertification( boolean _bAuthorizedDecertification )
423     {
424         this._bAuthorizedDecertification = _bAuthorizedDecertification;
425     }
426 
427     public boolean getAuthorizedAgentHistoryRead( )
428     {
429         return _bAuthorizedAgentHistoryRead;
430     }
431 
432     public void setAuthorizedAgentHistoryRead( boolean _bAuthorizedAgentHistoryRead )
433     {
434         this._bAuthorizedAgentHistoryRead = _bAuthorizedAgentHistoryRead;
435     }
436 
437     public int getDataRetentionPeriodInMonths( )
438     {
439         return _nDataRetentionPeriodInMonths;
440     }
441 
442     public void setDataRetentionPeriodInMonths( int _nDataRetentionPeriodInMonths )
443     {
444         this._nDataRetentionPeriodInMonths = _nDataRetentionPeriodInMonths;
445     }
446 
447     public List<AttributeRight> getAttributeRights( )
448     {
449         return _listAttributeRights;
450     }
451 
452     public void setAttributeRights( List<AttributeRight> attributeRights )
453     {
454         this._listAttributeRights = attributeRights;
455     }
456 
457     public List<AttributeCertification> getAttributeCertifications( )
458     {
459         return _listAttributeCertifications;
460     }
461 
462     public void setAttributeCertifications( List<AttributeCertification> attributeCertifications )
463     {
464         this._listAttributeCertifications = attributeCertifications;
465     }
466 
467     public List<AttributeRequirement> getAttributeRequirements( )
468     {
469         return _listAttributeRequirements;
470     }
471 
472     public void setAttributeRequirements( List<AttributeRequirement> attributeRequirements )
473     {
474         this._listAttributeRequirements = attributeRequirements;
475     }
476 }