Line 11... |
Line 11... |
11 |
import com.google.gwt.http.client.RequestCallback;
|
11 |
import com.google.gwt.http.client.RequestCallback;
|
12 |
import com.google.gwt.http.client.RequestException;
|
12 |
import com.google.gwt.http.client.RequestException;
|
13 |
import com.google.gwt.http.client.Response;
|
13 |
import com.google.gwt.http.client.Response;
|
14 |
import com.google.gwt.http.client.URL;
|
14 |
import com.google.gwt.http.client.URL;
|
15 |
import com.google.gwt.json.client.JSONArray;
|
15 |
import com.google.gwt.json.client.JSONArray;
|
- |
|
16 |
import com.google.gwt.json.client.JSONObject;
|
16 |
import com.google.gwt.json.client.JSONParser;
|
17 |
import com.google.gwt.json.client.JSONParser;
|
17 |
import com.google.gwt.json.client.JSONString;
|
18 |
import com.google.gwt.json.client.JSONString;
|
18 |
import com.google.gwt.json.client.JSONValue;
|
19 |
import com.google.gwt.json.client.JSONValue;
|
19 |
import com.google.gwt.user.client.Window;
|
20 |
import com.google.gwt.user.client.Window;
|
Line 52... |
Line 53... |
52 |
* à des critères données en paramètres
|
53 |
* à des critères données en paramètres
|
53 |
* @param r le rafraichissable qui demande la mise à jour
|
54 |
* @param r le rafraichissable qui demande la mise à jour
|
54 |
* @param criteres un tableau nom/valeur des critères pour les observations
|
55 |
* @param criteres un tableau nom/valeur des critères pour les observations
|
55 |
*/
|
56 |
*/
|
56 |
public final void obtenirListeObservation(final Rafraichissable r, final String utilisateur, final String[][] criteres)
|
57 |
public final void obtenirListeObservation(final Rafraichissable r, final String utilisateur, final String[][] criteres)
|
57 |
{
|
58 |
{
|
58 |
|
- |
|
59 |
|
- |
|
60 |
String requete = "" ;
|
59 |
String requete = "" ;
|
Line 61... |
Line 60... |
61 |
|
60 |
|
62 |
if(criteres != null)
|
61 |
if(criteres != null)
|
63 |
{
|
62 |
{
|
64 |
// on construit les paramètres du get avec les critères (&critere1=valeur1&critere2=valeur2 etc...)
|
63 |
// on construit les paramètres du get avec les critères (&critere1=valeur1&critere2=valeur2 etc...)
|
Line 65... |
Line 64... |
65 |
// ils contiennent limite et taille page et autres filtres (communes , lieu dit etc ...)S
|
64 |
// ils contiennent limite et taille page et autres filtres (communes , lieu dit etc ...)S
|
Line 66... |
Line -... |
66 |
|
- |
|
67 |
for (int i = 0; i < criteres.length; i++) {
|
- |
|
68 |
|
65 |
|
69 |
GWT.log(criteres[i][0]+" : "+criteres[i][1]);
|
66 |
for (int i = 0; i < criteres.length; i++) {
|
70 |
|
67 |
|
71 |
if(criteres[i][1] != null && !criteres[i][1].equals(""))
|
68 |
if(criteres[i][1] != null && !criteres[i][1].equals(""))
|
72 |
{
|
69 |
{
|
Line 100... |
Line 97... |
100 |
JSONArray reponse=null;
|
97 |
JSONArray reponse=null;
|
Line 101... |
Line 98... |
101 |
|
98 |
|
102 |
// si c'est un tableau
|
99 |
// si c'est un tableau
|
Line 103... |
Line 100... |
103 |
if ((reponse=responseValue.isArray()) != null) {
|
100 |
if ((reponse=responseValue.isArray()) != null) {
|
104 |
|
101 |
|
Line 105... |
Line 102... |
105 |
JSONArray observation;
|
102 |
JSONObject observation;
|
Line 106... |
Line 103... |
106 |
final int taillemax = reponse.size();
|
103 |
final int taillemax = reponse.size();
|
Line 107... |
Line 104... |
107 |
|
104 |
|
Line 108... |
Line 105... |
108 |
observationData = new ListeObservation(taillemax);
|
105 |
observationData = new ListeObservation(taillemax);
|
109 |
|
106 |
|
110 |
for (int i = 0; i < taillemax; i++) {
|
107 |
for (int i = 0; i < taillemax; i++) {
|
111 |
|
108 |
|
112 |
if ((observation=reponse.get(i).isArray()) != null) {
|
109 |
if ((observation=reponse.get(i).isObject()) != null) {
|
113 |
|
110 |
|
114 |
String transmis=((JSONString) observation.get(13)).stringValue();
|
111 |
String transmis=((JSONString) observation.get("transmission")).stringValue();
|
115 |
String identifiantLocalite=((JSONString) observation.get(14)).toString();
|
112 |
String identifiantLocalite=((JSONString) observation.get("ce_zone_geo")).toString();
|
116 |
String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString());
|
113 |
String nomSaisi=Util.toCelString(((JSONString) observation.get("nom_sel")).toString());
|
117 |
String nomRetenu=Util.toCelString(((JSONString) observation.get(2)).toString());
|
114 |
String nomRetenu=Util.toCelString(((JSONString) observation.get("nom_ret")).toString());
|
118 |
String numeroNomenclaturalSaisi=((JSONString) observation.get(1)).stringValue();
|
115 |
String numeroNomenclaturalSaisi=((JSONString) observation.get("nom_sel_nn")).stringValue();
|
119 |
String numeroNomenclaturalRetenu=((JSONString) observation.get(3)).stringValue();
|
116 |
String numeroNomenclaturalRetenu=((JSONString) observation.get("nom_ret_nn")).stringValue();
|
120 |
String numeroTaxonomique=((JSONString) observation.get(4)).stringValue();
|
117 |
String numeroTaxonomique=((JSONString) observation.get("nt")).stringValue();
|
121 |
String famille=Util.toCelString(((JSONString) observation .get(5)).toString());
|
118 |
String famille=Util.toCelString(((JSONString) observation .get("famille")).toString());
|
122 |
String localite=Util.toCelString(((JSONString) observation .get(6)).toString());
|
119 |
String localite=Util.toCelString(((JSONString) observation .get("zone_geo")).toString());
|
- |
|
120 |
String lieudit=Util.toCelString(((JSONString) observation .get("lieudit")).toString());
|
123 |
String lieudit=Util.toCelString(((JSONString) observation .get(9)).toString());
|
121 |
String station=Util.toCelString(((JSONString) observation .get("station")).toString());
|
124 |
String station=Util.toCelString(((JSONString) observation .get(10)).toString());
|
122 |
String milieu=Util.toCelString(((JSONString) observation .get("milieu")).toString());
|
125 |
String milieu=Util.toCelString(((JSONString) observation .get(11)).toString());
|
123 |
String commentaire=Util.toCelString(((JSONString) observation .get("commentaire")).toString());
|
Line 126... |
Line 124... |
126 |
String commentaire=Util.toCelString(((JSONString) observation .get(12)).toString());
|
124 |
String date=((JSONString) observation .get("date_observation")).stringValue();
|
127 |
String date=((JSONString) observation .get(8)).stringValue();
|
125 |
String numeroOrdre=((JSONString) observation.get("ordre")).stringValue();
|
128 |
String numeroOrdre=((JSONString) observation.get(7)).stringValue();
|
126 |
String numeroId=((JSONString) observation.get("id_observation")).stringValue();
|
- |
|
127 |
String coordX=((JSONString) observation.get("latitude")).stringValue();
|
129 |
String coordX=((JSONString) observation.get(15)).stringValue();
|
128 |
String coordY=((JSONString) observation.get("longitude")).stringValue();
|
130 |
String coordY=((JSONString) observation.get(16)).stringValue();
|
129 |
String motsCles=((JSONString) observation.get("mots_cles")).stringValue();
|
131 |
String motsCles=((JSONString) observation.get(17)).stringValue();
|
- |
|
132 |
|
- |
|
133 |
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre/*, motsCles*/);
|
130 |
|
134 |
obs.setCoordonneeX(coordX);
|
131 |
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre/*, motsCles*/);
|
135 |
obs.setCoordonneeY(coordY);
|
132 |
obs.setCoordonneeX(coordX);
|
Line 136... |
Line 133... |
136 |
obs.setMotsCles(motsCles);
|
133 |
obs.setCoordonneeY(coordY);
|
Line 198... |
Line 195... |
198 |
|
195 |
|
199 |
if(obs.getCommentaire() != null) {
|
196 |
if(obs.getCommentaire() != null) {
|
200 |
postData += "&commentaire="+obs.getCommentaire();
|
197 |
postData += "&commentaire="+obs.getCommentaire();
|
Line 201... |
Line 198... |
201 |
}
|
198 |
}
|
202 |
|
199 |
|
203 |
if(obs.getCoordonneeX() != null ) {
|
200 |
if(obs.getLatitude() != null ) {
|
Line 204... |
Line 201... |
204 |
postData += "&coord_x="+URL.encodeComponent(""+obs.getCoordonneeX());
|
201 |
postData += "&coord_x="+URL.encodeComponent(""+obs.getLatitude());
|
205 |
}
|
202 |
}
|
206 |
|
203 |
|
Line 207... |
Line 204... |
207 |
if(obs.getCoordonneeY() != null) {
|
204 |
if(obs.getLongitude() != null) {
|
Line 208... |
Line 205... |
208 |
postData += "&coord_y="+URL.encodeComponent(""+obs.getCoordonneeY());
|
205 |
postData += "&coord_y="+URL.encodeComponent(""+obs.getLongitude());
|