108 |
aurelien |
1 |
package org.tela_botanica.client.modeles;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
4 |
import org.tela_botanica.client.observation.ObservationModele;
|
|
|
5 |
|
|
|
6 |
import com.google.gwt.http.client.Request;
|
|
|
7 |
import com.google.gwt.http.client.RequestBuilder;
|
|
|
8 |
import com.google.gwt.http.client.RequestCallback;
|
|
|
9 |
import com.google.gwt.http.client.RequestException;
|
|
|
10 |
import com.google.gwt.http.client.Response;
|
|
|
11 |
import com.google.gwt.json.client.JSONArray;
|
|
|
12 |
import com.google.gwt.json.client.JSONParser;
|
|
|
13 |
import com.google.gwt.json.client.JSONString;
|
|
|
14 |
import com.google.gwt.json.client.JSONValue;
|
|
|
15 |
import com.google.gwt.user.client.Window;
|
|
|
16 |
|
|
|
17 |
public class TransmissionObservationAsynchroneDAO {
|
|
|
18 |
|
|
|
19 |
ObservationModele om = null ;
|
|
|
20 |
|
|
|
21 |
public TransmissionObservationAsynchroneDAO(ObservationModele observationModele) {
|
|
|
22 |
om = observationModele ;
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
public void transmettreObservations(final Rafraichissable r, String identifiant, String idsObs) {
|
|
|
26 |
|
|
|
27 |
// on envoie le get asynchrone
|
|
|
28 |
String post = "&transmission=1";
|
|
|
29 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,Configuration.getServiceBaseUrl()
|
|
|
30 |
+"/InventoryTransmit/"+om.getIdentifiant()+"/"+idsObs) ;
|
|
|
31 |
|
|
|
32 |
try {
|
|
|
33 |
rb.sendRequest(post, new RequestCallback() {
|
|
|
34 |
|
|
|
35 |
public void onError(Request request, Throwable exception) {
|
|
|
36 |
// TODO Auto-generated method stub
|
|
|
37 |
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
public void onResponseReceived(Request request,
|
|
|
41 |
Response response) {
|
|
|
42 |
|
|
|
43 |
r.rafraichir("OK",true);
|
|
|
44 |
}
|
|
|
45 |
}) ;
|
|
|
46 |
|
|
|
47 |
} catch (RequestException e) {
|
|
|
48 |
// TODO Auto-generated catch block
|
|
|
49 |
e.printStackTrace();
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
}
|
|
|
57 |
|