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 /* 36 Sample from dgfip (mockup from opendatasoft) 37 { 38 "parameters" : { 39 "rows" : 10, 40 "dataset" : [ 41 "dgfip_rfr" 42 ], 43 "format" : "json", 44 "timezone" : "UTC" 45 }, 46 "nhits" : 1, 47 "records" : [ 48 { 49 "fields" : { 50 "pays_de_naissance" : "99100", 51 "nom_d_usage" : "PETIT", 52 "prenom_de_naissance_enfants" : "PIERRE, LUCIEN", 53 "date_de_naissance" : "1985-01-05", 54 "nom_de_naissance_du_conjoint" : "PETIT", 55 "sexe" : "female", 56 "prenoms" : "Patricia", 57 "nom_de_naissance" : "AMA", 58 "rfr" : 54000, 59 "hypothese_dgfip" : "Couple marié avec PETIT, 2 enfants (né en 2010 et 2013), revenu 30K€+30K€, nés en 1983 et 85, vivent en métropole", 60 "reference_de_l_avis" : "15 78A001138 37", 61 "p237" : "https://doc.integ01.dev-franceconnect.fr/tmp/P237.pdf", 62 "avisn_1" : "https://doc.integ01.dev-franceconnect.fr/tmp/Petit 2015.pdf", 63 "prenom_de_naissance_du_conjoint" : "Francois -Pierre", 64 "nombre_de_parts" : 3, 65 "lieu_de_naissance" : "91471", 66 "avisn_2" : "https://doc.integ01.dev-franceconnect.fr/tmp/Petit 2014.pdf", 67 "situation_foyer" : "M", 68 "avisn_3" : "https://doc.integ01.dev-franceconnect.fr/tmp/Petit 2013.pdf" 69 }, 70 "recordid" : "2f567b361eaafb712cfdb1c5bc28e099c2f32310", 71 "datasetid" : "dgfip_rfr", 72 "record_timestamp" : "2015-06-17T15:46:07+00:00" 73 } 74 ] 75 } 76 * 77 */ 78 79 package fr.paris.lutece.plugins.fcsample.dataclient; 80 81 import java.io.Serializable; 82 import java.util.Map; 83 84 import com.fasterxml.jackson.annotation.JsonProperty; 85 86 87 /** 88 * UserRevenu 89 */ 90 public class UserRevenu implements Serializable 91 { 92 private static final long serialVersionUID = 1L; 93 94 private Integer nRFR; 95 96 /** 97 * Sets the Records 98 * @param records The Records 99 */ 100 @JsonProperty( "records" ) 101 public void setRecords( Object[] records ) 102 { 103 //"rfr" : 54000, 104 //"nombre_de_parts" : 3, 105 // 106 Map<String, Object> record = ( Map<String,Object> ) records[0]; 107 Map<String, Object> fields = ( Map<String,Object> ) record.get( "fields" ); 108 Integer RFR = ( Integer ) fields.get( "rfr" ); 109 nRFR = RFR; 110 } 111 112 /** 113 * Returns the RFR 114 * @return The RFR 115 */ 116 public Integer getRFR( ) 117 { 118 return nRFR; 119 } 120 }