| Line 17... |
Line 17... |
| 17 |
import com.google.gwt.user.client.HTTPRequest;
|
17 |
import com.google.gwt.user.client.HTTPRequest;
|
| 18 |
import com.google.gwt.user.client.ResponseTextHandler;
|
18 |
import com.google.gwt.user.client.ResponseTextHandler;
|
| Line 19... |
Line 19... |
| 19 |
|
19 |
|
| Line 20... |
Line -... |
| 20 |
public class ObservationAsynchroneDAO {
|
- |
|
| 21 |
|
- |
|
| 22 |
|
20 |
public class ObservationAsynchroneDAO {
|
| 23 |
|
21 |
|
| 24 |
/**
|
22 |
/**
|
| 25 |
* Constructeur
|
- |
|
| 26 |
*/
|
- |
|
| 27 |
|
- |
|
| 28 |
public ObservationAsynchroneDAO() {
|
- |
|
| 29 |
|
- |
|
| 30 |
|
- |
|
| 31 |
}
|
- |
|
| 32 |
|
- |
|
| 33 |
|
- |
|
| 34 |
public void getNombreObservation(String baseURL, final iRetourObservation retour, String identifiant, String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre) {
|
- |
|
| 35 |
|
- |
|
| 36 |
|
- |
|
| 37 |
HTTPRequest.asyncGet(baseURL + "/InventoryItemList/" + identifiant + "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) + "/" + annee + "/" + mois + "/" + jour + "/" + URL.encodeComponent(rechercheLibre) + "/" + URL.encodeComponent(lieudit),
|
- |
|
| 38 |
new ResponseTextHandler() {
|
- |
|
| 39 |
|
- |
|
| 40 |
public void onCompletion(String str) {
|
- |
|
| 41 |
|
- |
|
| 42 |
JSONValue jsonValue = JSONParser.parse(str);
|
- |
|
| 43 |
JSONNumber jsonNumber;
|
- |
|
| 44 |
if ((jsonNumber = jsonValue.isNumber()) != null) {
|
- |
|
| 45 |
retour.onRetour(new Observation((int) jsonNumber.getValue()));
|
- |
|
| 46 |
}
|
- |
|
| Line 47... |
Line -... |
| 47 |
}
|
- |
|
| - |
|
23 |
* Constructeur
|
| Line -... |
Line 24... |
| - |
|
24 |
*/
|
| Line -... |
Line 25... |
| - |
|
25 |
|
| - |
|
26 |
public ObservationAsynchroneDAO() {
|
| - |
|
27 |
|
| - |
|
28 |
}
|
| - |
|
29 |
|
| - |
|
30 |
public void getNombreObservation(String baseURL,
|
| - |
|
31 |
final iRetourObservation retour, String identifiant,
|
| - |
|
32 |
String identifiantLocalite, String localite, String annee,
|
| - |
|
33 |
String mois, String jour, String lieudit, String rechercheLibre) {
|
| - |
|
34 |
|
| - |
|
35 |
HTTPRequest.asyncGet(baseURL + "/InventoryItemList/" + identifiant
|
| - |
|
36 |
+ "/" + identifiantLocalite + "/"
|
| - |
|
37 |
+ URL.encodeComponent(localite) + "/" + annee + "/" + mois
|
| - |
|
38 |
+ "/" + jour + "/" + URL.encodeComponent(rechercheLibre) + "/"
|
| - |
|
39 |
+ URL.encodeComponent(lieudit), new ResponseTextHandler() {
|
| - |
|
40 |
|
| - |
|
41 |
public void onCompletion(String str) {
|
| - |
|
42 |
|
| - |
|
43 |
JSONValue jsonValue = JSONParser.parse(str);
|
| - |
|
44 |
JSONNumber jsonNumber;
|
| - |
|
45 |
if ((jsonNumber = jsonValue.isNumber()) != null) {
|
| - |
|
46 |
retour
|
| Line -... |
Line 47... |
| - |
|
47 |
.onRetour(new Observation((int) jsonNumber
|
| - |
|
48 |
.getValue()));
|
| - |
|
49 |
}
|
| - |
|
50 |
}
|
| - |
|
51 |
});
|
| 48 |
});
|
52 |
|
| - |
|
53 |
}
|
| - |
|
54 |
|
| - |
|
55 |
public void getListeObservation(String baseURL,
|
| - |
|
56 |
final iRetourObservation retour, String identifiant,
|
| - |
|
57 |
String identifiantLocalite, String localite, String annee,
|
| - |
|
58 |
String mois, String jour, String lieudit, String rechercheLibre,
|
| - |
|
59 |
int debut, int longueur) {
|
| - |
|
60 |
|
| - |
|
61 |
HTTPRequest.asyncGet(baseURL + "/InventoryItemList/" + identifiant
|
| 49 |
|
62 |
+ "/" + identifiantLocalite + "/"
|
| - |
|
63 |
+ URL.encodeComponent(localite) + "/" + annee + "/" + mois
|
| 50 |
}
|
64 |
+ "/" + jour + "/" + URL.encodeComponent(rechercheLibre) + "/"
|
| - |
|
65 |
+ URL.encodeComponent(lieudit) + "/" + debut + "/" + longueur,
|
| - |
|
66 |
|
| - |
|
67 |
new ResponseTextHandler() {
|
| Line 51... |
Line 68... |
| 51 |
|
68 |
|
| 52 |
|
- |
|
| 53 |
|
- |
|
| 54 |
public void getListeObservation(String baseURL,final iRetourObservation retour, String identifiant, String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre, int debut, int longueur)
|
- |
|
| 55 |
{
|
- |
|
| 56 |
|
- |
|
| Line 57... |
Line -... |
| 57 |
|
- |
|
| 58 |
HTTPRequest.asyncGet(baseURL + "/InventoryItemList/" + identifiant + "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" + annee + "/" + mois + "/" + jour + "/" + URL.encodeComponent(rechercheLibre) + "/" + URL.encodeComponent(lieudit) + "/"
|
- |
|
| 59 |
+ debut + "/" + longueur ,
|
- |
|
| 60 |
|
- |
|
| 61 |
new ResponseTextHandler() {
|
69 |
public void onCompletion(String str) {
|
| 62 |
|
70 |
|
| 63 |
public void onCompletion(String str) {
|
- |
|
| 64 |
|
- |
|
| 65 |
JSONValue jsonValue = JSONParser.parse(str);
|
71 |
JSONValue jsonValue = JSONParser.parse(str);
|
| 66 |
JSONArray jsonArray;
|
72 |
JSONArray jsonArray;
|
| 67 |
JSONArray jsonArrayNested;
|
73 |
JSONArray jsonArrayNested;
|
| 68 |
|
74 |
|
| 69 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
75 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
| 70 |
|
76 |
|
| 71 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
77 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
| 72 |
|
78 |
|
| 73 |
int arraySize = jsonArray.size();
|
79 |
int arraySize = jsonArray.size();
|
| - |
|
80 |
|
| - |
|
81 |
Observation[] listeObservation = new Observation[arraySize];
|
| 74 |
|
82 |
|
| - |
|
83 |
for (int i = 0; i < arraySize; i++) {
|
| - |
|
84 |
|
| 75 |
Observation[] listeObservation=new Observation[arraySize];
|
85 |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
|
| - |
|
86 |
|
| 76 |
|
87 |
String transmis = ((JSONString) jsonArrayNested
|
| - |
|
88 |
.get(13)).stringValue();
|
| 77 |
for (int i = 0; i < arraySize; i++) {
|
89 |
String nomSaisi = Util
|
| - |
|
90 |
.toCelString(((JSONString) jsonArrayNested
|
| - |
|
91 |
.get(0)).toString());
|
| 78 |
|
92 |
String nomRetenu = Util
|
| - |
|
93 |
.toCelString(((JSONString) jsonArrayNested
|
| - |
|
94 |
.get(2)).toString());
|
| 79 |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
|
95 |
String numeroNomenclatural = ((JSONString) jsonArrayNested
|
| - |
|
96 |
.get(3)).stringValue();
|
| - |
|
97 |
String numeroTaxonomique = ((JSONString) jsonArrayNested
|
| 80 |
|
98 |
.get(4)).stringValue();
|
| - |
|
99 |
String famille = Util
|
| - |
|
100 |
.toCelString(((JSONString) jsonArrayNested
|
| 81 |
String transmis=((JSONString) jsonArrayNested.get(13)).stringValue();
|
101 |
.get(5)).toString());
|
| - |
|
102 |
String localite = Util
|
| - |
|
103 |
.toCelString(((JSONString) jsonArrayNested
|
| 82 |
String nomSaisi=Util.toCelString(((JSONString) jsonArrayNested.get(0)).toString());
|
104 |
.get(6)).toString());
|
| - |
|
105 |
String lieudit = Util
|
| - |
|
106 |
.toCelString(((JSONString) jsonArrayNested
|
| 83 |
String nomRetenu=Util.toCelString(((JSONString) jsonArrayNested.get(2)).toString());
|
107 |
.get(9)).toString());
|
| - |
|
108 |
String station = Util
|
| 84 |
String numeroNomenclatural=((JSONString) jsonArrayNested.get(3)).stringValue();
|
109 |
.toCelString(((JSONString) jsonArrayNested
|
| - |
|
110 |
.get(10)).toString());
|
| 85 |
String numeroTaxonomique=((JSONString) jsonArrayNested.get(4)).stringValue();
|
111 |
String milieu = Util
|
| - |
|
112 |
.toCelString(((JSONString) jsonArrayNested
|
| 86 |
String famille=Util.toCelString(((JSONString) jsonArrayNested .get(5)).toString());
|
113 |
.get(11)).toString());
|
| 87 |
String localite=Util.toCelString(((JSONString) jsonArrayNested .get(6)).toString());
|
114 |
String commentaire = Util
|
| 88 |
String lieudit=Util.toCelString(((JSONString) jsonArrayNested .get(9)).toString());
|
115 |
.toCelString(((JSONString) jsonArrayNested
|
| - |
|
116 |
.get(12)).toString());
|
| 89 |
String station=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString());
|
117 |
String date = ((JSONString) jsonArrayNested
|
| 90 |
String milieu=Util.toCelString(((JSONString) jsonArrayNested .get(11)).toString());
|
118 |
.get(8)).stringValue();
|
| 91 |
String commentaire=Util.toCelString(((JSONString) jsonArrayNested .get(12)).toString());
|
- |
|
| 92 |
String date=((JSONString) jsonArrayNested .get(8)).stringValue();
|
119 |
String numeroOrdre = ((JSONString) jsonArrayNested
|
| - |
|
120 |
.get(7)).stringValue();
|
| - |
|
121 |
|
| 93 |
String numeroOrdre=((JSONString) jsonArrayNested.get(7)).stringValue();
|
122 |
listeObservation[i] = new Observation(transmis,
|
| 94 |
|
123 |
nomSaisi, nomRetenu,
|
| 95 |
listeObservation[i]=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclatural, numeroTaxonomique, famille, localite, lieudit, station, milieu, commentaire, date, numeroOrdre);
|
- |
|
| 96 |
}
|
- |
|
| 97 |
}
|
- |
|
| 98 |
retour.onRetour(new Observation(listeObservation));
|
- |
|
| 99 |
|
- |
|
| Line -... |
Line 124... |
| - |
|
124 |
numeroNomenclatural, numeroTaxonomique,
|
| - |
|
125 |
famille, localite, lieudit, station,
|
| Line -... |
Line 126... |
| - |
|
126 |
milieu, commentaire, date, numeroOrdre);
|
| Line -... |
Line 127... |
| - |
|
127 |
}
|
| Line 100... |
Line 128... |
| 100 |
}
|
128 |
}
|