Subversion Repositories eFlore/Applications.cel

Rev

Rev 235 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
145 aurelien 25
	public void transmettreObservations(final Rafraichissable r, String identifiant, String idsObs, boolean publier) {
108 aurelien 26
 
27
		// on envoie le get asynchrone
145 aurelien 28
		String post = "&transmission=";
29
 
30
		if(publier) {
31
			post += "1";
32
		}
33
		else
34
		{
35
			post += "0" ;
36
		}
37
 
108 aurelien 38
		RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,Configuration.getServiceBaseUrl()
39
				+"/InventoryTransmit/"+om.getIdentifiant()+"/"+idsObs) ;
40
 
41
		try {
42
			rb.sendRequest(post, new RequestCallback() {
43
 
44
				public void onError(Request request, Throwable exception) {
45
					// TODO Auto-generated method stub
46
 
47
				}
48
 
49
				public void onResponseReceived(Request request,
50
						Response response) {
51
 
52
					r.rafraichir("OK",true);
53
				}
54
			}) ;
55
 
56
		} catch (RequestException e) {
57
			// TODO Auto-generated catch block
58
			e.printStackTrace();
59
		}
60
 
61
	}
62
 
63
 
64
 
65
}
66