Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

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