| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.modeles;
|
1 |
package org.tela_botanica.client.modeles;
|
| Line -... |
Line 2... |
| - |
|
2 |
|
| 2 |
|
3 |
import org.tela_botanica.client.Util;
|
| 3 |
import org.tela_botanica.client.image.ImageModele;
|
4 |
import org.tela_botanica.client.image.ImageModele;
|
| 4 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| Line 5... |
Line 6... |
| 5 |
import org.tela_botanica.client.observation.ObservationModele;
|
6 |
import org.tela_botanica.client.observation.ObservationModele;
|
| Line 42... |
Line 43... |
| 42 |
}
|
43 |
}
|
| Line 43... |
Line 44... |
| 43 |
|
44 |
|
| 44 |
public void obtenirLiaisonsImagesObservations(Rafraichissable r,String id)
|
45 |
public void obtenirLiaisonsImagesObservations(Rafraichissable r,String id)
|
| 45 |
{
|
46 |
{
|
| 46 |
String paramGet = "&coi_ce_image="+id ;
|
47 |
String paramGet = "&coi_ce_image="+id ;
|
| - |
|
48 |
|
| - |
|
49 |
raf = r ;
|
| 47 |
|
50 |
|
| 48 |
// et on envoie ça au serveur
|
51 |
// et on envoie ça au serveur
|
| 49 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, iModele
|
52 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, iModele
|
| 50 |
.getConfig().getServiceBaseUrl()
|
53 |
.getConfig().getServiceBaseUrl()
|
| 51 |
+ "/inventoryImageLink/" + iModele.getIdentifiant() + "/" + paramGet);
|
54 |
+ "/inventoryImageLink/" + iModele.getIdentifiant() + "/" + paramGet);
|
| Line 58... |
Line 61... |
| 58 |
}
|
61 |
}
|
| Line 59... |
Line 62... |
| 59 |
|
62 |
|
| 60 |
public void onResponseReceived(Request request,
|
63 |
public void onResponseReceived(Request request,
|
| Line -... |
Line 64... |
| - |
|
64 |
Response response) {
|
| - |
|
65 |
|
| - |
|
66 |
final ListeObservation observationData ;
|
| - |
|
67 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
| - |
|
68 |
|
| - |
|
69 |
JSONArray reponse=null;
|
| - |
|
70 |
|
| - |
|
71 |
// si c'est un tableau
|
| - |
|
72 |
if ((reponse=responseValue.isArray()) != null) {
|
| 61 |
Response response) {
|
73 |
|
| - |
|
74 |
JSONArray observation;
|
| - |
|
75 |
final int taillemax = reponse.size();
|
| - |
|
76 |
|
| - |
|
77 |
observationData = new ListeObservation(taillemax);
|
| - |
|
78 |
|
| - |
|
79 |
for (int i = 0; i < taillemax; i++) {
|
| - |
|
80 |
|
| - |
|
81 |
if ((observation=reponse.get(i).isArray()) != null) {
|
| - |
|
82 |
|
| - |
|
83 |
String transmis=((JSONString) observation.get(13)).stringValue();
|
| - |
|
84 |
String identifiantLocalite=((JSONString) observation.get(14)).toString();
|
| - |
|
85 |
String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString());
|
| - |
|
86 |
String nomRetenu=Util.toCelString(((JSONString) observation.get(2)).toString());
|
| - |
|
87 |
String numeroNomenclaturalSaisi=((JSONString) observation.get(1)).stringValue();
|
| - |
|
88 |
String numeroNomenclaturalRetenu=((JSONString) observation.get(3)).stringValue();
|
| - |
|
89 |
String numeroTaxonomique=((JSONString) observation.get(4)).stringValue();
|
| - |
|
90 |
String famille=Util.toCelString(((JSONString) observation .get(5)).toString());
|
| - |
|
91 |
String localite=Util.toCelString(((JSONString) observation .get(6)).toString());
|
| - |
|
92 |
String lieudit=Util.toCelString(((JSONString) observation .get(9)).toString());
|
| - |
|
93 |
String station=Util.toCelString(((JSONString) observation .get(10)).toString());
|
| - |
|
94 |
String milieu=Util.toCelString(((JSONString) observation .get(11)).toString());
|
| - |
|
95 |
String commentaire=Util.toCelString(((JSONString) observation .get(12)).toString());
|
| - |
|
96 |
String date=((JSONString) observation .get(8)).stringValue();
|
| - |
|
97 |
String numeroOrdre=((JSONString) observation.get(7)).stringValue();
|
| - |
|
98 |
|
| - |
|
99 |
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre);
|
| - |
|
100 |
|
| - |
|
101 |
observationData.put(obs.getNumeroOrdre(),obs);
|
| - |
|
102 |
|
| - |
|
103 |
|
| - |
|
104 |
}
|
| - |
|
105 |
|
| - |
|
106 |
}
|
| - |
|
107 |
} else {
|
| - |
|
108 |
|
| - |
|
109 |
observationData = new ListeObservation(0) ;
|
| - |
|
110 |
}
|
| - |
|
111 |
|
| 62 |
|
112 |
// dans tous les cas on transmet la liste crée au rafraichissable en lui demandant de répandre les données car il est
|
| - |
|
113 |
// le premier à les recevoir
|
| - |
|
114 |
|
| 63 |
Window.alert(response.getText()) ;
|
115 |
// TODO : ce n'est pas ici qu'on devrait le decider ..
|
| 64 |
|
116 |
raf.rafraichir(observationData,true);
|
| Line 65... |
Line 117... |
| 65 |
}
|
117 |
}
|
| 66 |
});
|
118 |
});
|