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;
1918 aurelien 9
import org.tela_botanica.client.util.RequestBuilderWithCredentials;
108 aurelien 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
 
14
public class TransmissionObservationAsynchroneDAO {
15
 
16
	ObservationModele om = null ;
17
 
18
	public TransmissionObservationAsynchroneDAO(ObservationModele observationModele) {
19
		om = observationModele ;
20
	}
21
 
145 aurelien 22
	public void transmettreObservations(final Rafraichissable r, String identifiant, String idsObs, boolean publier) {
108 aurelien 23
 
24
		// on envoie le get asynchrone
145 aurelien 25
		String post = "&transmission=";
26
 
27
		if(publier) {
28
			post += "1";
29
		}
30
		else
31
		{
32
			post += "0" ;
33
		}
34
 
1918 aurelien 35
		RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.POST,Configuration.getServiceBaseUrl()
937 aurelien 36
				+"/InventoryTransmit/"+Utilisateur.getInstance().getIdentifiantUtilisateurConsulte()+"/"+idsObs) ;
108 aurelien 37
 
38
		try {
39
			rb.sendRequest(post, new RequestCallback() {
40
 
1293 aurelien 41
				@Override
108 aurelien 42
				public void onError(Request request, Throwable exception) {
43
					// TODO Auto-generated method stub
44
 
45
				}
46
 
1293 aurelien 47
				@Override
108 aurelien 48
				public void onResponseReceived(Request request,
49
						Response response) {
50
 
51
					r.rafraichir("OK",true);
52
				}
53
			}) ;
54
 
55
		} catch (RequestException e) {
56
			// TODO Auto-generated catch block
57
			e.printStackTrace();
58
		}
59
 
60
	}
61
 
62
 
63
 
64
}
65