View Javadoc
1   /*
2    * Copyright (c) 2002-2018, Mairie de 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.aot.modules.declarationimmat.business;
35  
36  import java.io.Serializable;
37  import java.sql.Timestamp;
38  import java.util.ArrayList;
39  import java.util.List;
40  
41  import javax.validation.constraints.NotNull;
42  import javax.xml.bind.annotation.XmlElement;
43  import javax.xml.bind.annotation.XmlRootElement;
44  import javax.xml.bind.annotation.XmlTransient;
45  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
46  
47  import fr.paris.lutece.plugins.aot.modules.declarationimmat.utils.TimestampAdapter;
48  import fr.paris.lutece.plugins.aot.modules.declarationimmat.utils.TypeVehicleAdapter;
49  import fr.paris.lutece.plugins.aot.modules.declarationimmat.utils.TypeVehicleUtils;
50  
51  /**
52   * This is the business class for the object Place
53   */ 
54  @XmlRootElement( name = "place" )
55  public class Place implements Serializable
56  {
57      private static final long serialVersionUID = 1L;
58  
59      private int _nId;
60      private String _strNumber;
61      private Timestamp _dateStartDate;
62      private Timestamp _dateEndDate;
63      private List<TypeVehicle> _typesVehicle;
64      private String _strTypePlace;
65      private int _nSiteId;
66      private List<Ticket> _tickets = new ArrayList<>( );
67  
68      private int _nNumberOfAuthorizations = 1;
69  
70      @XmlElement( name = "id" )
71      public int getId( )
72      {
73          return _nId;
74      }
75  
76      public void setId( int nId )
77      {
78          _nId = nId;
79      }
80  
81      @XmlElement( name = "number" )
82      public String getNumber( )
83      {
84          return _strNumber;
85      }
86  
87      public void setNumber( String strNumber )
88      {
89          _strNumber = strNumber;
90      }
91  
92      @NotNull
93      @XmlJavaTypeAdapter( TimestampAdapter.class )
94      @XmlElement( name = "startDate" )
95      public Timestamp getStartDate( )
96      {
97          return _dateStartDate;
98      }
99  
100     public void setStartDate( Timestamp dateStartDate )
101     {
102         _dateStartDate = dateStartDate;
103     }
104 
105     @NotNull
106     @XmlJavaTypeAdapter( TimestampAdapter.class )
107     @XmlElement( name = "endDate" )
108     public Timestamp getEndDate( )
109     {
110         return _dateEndDate;
111     }
112 
113     public void setEndDate( Timestamp dateEndDate )
114     {
115         _dateEndDate = dateEndDate;
116     }
117 
118     @XmlJavaTypeAdapter( TypeVehicleAdapter.class )
119     @XmlElement( name = "typesVehicle" )
120     public List<TypeVehicle> getTypesVehicle( )
121     {
122         return _typesVehicle;
123     }
124 
125     public void setTypesVehicle( List<TypeVehicle> typesVehicle )
126     {
127         _typesVehicle = typesVehicle;
128     }
129 
130     public void setTypesVehicleAsString( String strTypesVehicle )
131     {
132         _typesVehicle = TypeVehicleUtils.codesToTypes( strTypesVehicle );
133     }
134 
135     @XmlElement( name = "typePlace" )
136     public String getTypePlace( )
137     {
138         return _strTypePlace;
139     }
140 
141     public void setTypePlace( String strTypePlace )
142     {
143         _strTypePlace = strTypePlace;
144     }
145 
146     @XmlTransient
147     public int getSiteId( )
148     {
149         return _nSiteId;
150     }
151 
152     public void setSiteId( int nSiteId )
153     {
154         _nSiteId = nSiteId;
155     }
156 
157     @XmlTransient
158     public List<Ticket> getTickets( )
159     {
160         return _tickets;
161     }
162 
163     public void setTickets( List<Ticket> tickets )
164     {
165         this._tickets = tickets;
166     }
167 
168     @XmlElement( name = "numberOfAuthorizations" )
169     public int getNumberOfAuthorizations( )
170     {
171         return _nNumberOfAuthorizations;
172     }
173 
174     public void setNumberOfAuthorizations( int numberOfAuthorizations )
175     {
176         this._nNumberOfAuthorizations = numberOfAuthorizations;
177     }
178 
179 }