1 /*
2 * Copyright (c) 2002-2015, 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
35 package fr.paris.lutece.plugins.stationnement.dataclient;
36
37 import java.io.Serializable;
38 import java.util.Map;
39
40 import com.fasterxml.jackson.annotation.JsonProperty;
41
42 /*
43 Sample from siv https://siv-vabf-part.interieur.gouv.fr/vehicule/AD-208-AM
44 {
45 "vehicule": {
46 "classeEnvironnementale": "70/220*2001/100EURO4",
47 "co2": 160,
48 "energie": "GO",
49 "cylindree": 1870,
50 "numImmat": "AD-208-AM",
51 "datePremImmat": "2017-02-01",
52 "marque": "RENAULT",
53 "typeVarianteVersion": "JMGDN6",
54 "denominationCommerciale": "MEGANE SCENIC",
55 "ptac": 2130,
56 "categorie": "M1",
57 "genre": "VP"
58 },
59 "personne": {
60 "adresse": {
61 "commune": "MARSEILLE",
62 "etageEscalierAppartement": null,
63 "complement": null,
64 "numeroDeVoie": "12",
65 "extention": null,
66 "typeDeVoie": "RUE",
67 "nomDeLaVoie": "LA CANEBIERE",
68 "lieuDit": null,
69 "codePostal": "13001"
70 },
71 "raisonSociale": null,
72 "prenom": "PATRICK",
73 "nom": "DELL"
74 }
75 }
76 *
77 */
78
79 /**
80 * CartesGrise
81 */
82 public class CarteGrise implements Serializable
83 {
84
85 /**
86 *
87 */
88 private static final long serialVersionUID = 1L;
89
90 private String _strAdresse;
91 private String _strTPpNom;
92 private String _strTPpPrenom;
93 private String _strVDenominationCommerciale;
94 private String _strVNumeroImmatriculation;
95 private String _strVMarque;
96
97 private String _strSource;
98
99 public void setTPpPrenom( String strTPpPrenom )
100 {
101 _strTPpPrenom = strTPpPrenom;
102 }
103 public String getTPpPrenom( )
104 {
105 return _strTPpPrenom;
106 }
107
108 public void setTPpNom( String strTPpNom )
109 {
110 _strTPpNom = strTPpNom;
111 }
112 public String getTPpNom( )
113 {
114 return _strTPpNom;
115 }
116
117 public void setVDenominationCommerciale( String strVDenominationCommerciale )
118 {
119 _strVDenominationCommerciale = strVDenominationCommerciale;
120 }
121 public String getVDenominationCommerciale( )
122 {
123 return _strVDenominationCommerciale;
124 }
125
126 public void setVNumeroImmatriculation( String strVNumeroImmatriculation )
127 {
128 _strVNumeroImmatriculation = strVNumeroImmatriculation;
129 }
130 public String getVNumeroImmatriculation( )
131 {
132 return _strVNumeroImmatriculation;
133 }
134
135 public void setVMarque( String strVMarque )
136 {
137 _strVMarque = strVMarque;
138 }
139 public String getVMarque( )
140 {
141 return _strVMarque;
142 }
143
144 public void setAdresse( String strAdresse )
145 {
146 _strAdresse = strAdresse;
147 }
148 public String getAdresse( )
149 {
150 return _strAdresse;
151 }
152
153 @JsonProperty( "personne" )
154 public void setPersonne( Map<String, Object> personne ) {
155 setTPpNom((String)personne.get("nom"));
156 setTPpPrenom((String)personne.get("prenom"));
157 Map<String, String> mapAdresse =(Map<String,String>) personne.get("adresse");
158 setAdresse(
159 mapAdresse.get("numeroDeVoie") + " " +
160 mapAdresse.get("typeDeVoie") + " " +
161 mapAdresse.get("nomDeLaVoie") + ", " +
162 mapAdresse.get("codePostal") + " " +
163 mapAdresse.get("commune")
164 );
165 }
166
167 @JsonProperty( "vehicule" )
168 public void setVehicule( Map<String, String> vehicule ) {
169 setVNumeroImmatriculation(vehicule.get("numImmat"));
170 setVDenominationCommerciale(vehicule.get("denominationCommerciale"));
171 setVMarque(vehicule.get("marque"));
172 }
173
174 public void setSource( String strSource )
175 {
176 _strSource = strSource;
177 }
178 public String getSource( )
179 {
180 return _strSource;
181 }
182 }