Subversion Repositories eFlore/Applications.cel

Rev

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

Rev Author Line No. Line
989 aurelien 1
package org.tela_botanica.client.modeles.dao;
140 aurelien 2
 
989 aurelien 3
import org.tela_botanica.client.modeles.objets.Configuration;
4
import org.tela_botanica.client.modeles.objets.Utilisateur;
157 aurelien 5
import org.tela_botanica.client.observation.ObservationModele;
140 aurelien 6
 
7
import com.google.gwt.http.client.Request;
1918 aurelien 8
import org.tela_botanica.client.util.RequestBuilderWithCredentials;
140 aurelien 9
import com.google.gwt.http.client.RequestCallback;
10
import com.google.gwt.http.client.RequestException;
11
import com.google.gwt.http.client.Response;
12
 
13
public class ImportObservationAsynchroneDAO {
14
 
15
	private ObservationModele oModele = null ;
16
 
17
	public ImportObservationAsynchroneDAO(ObservationModele observationModele) {
18
		oModele = observationModele;
19
	}
20
 
21
	public void importerObservations() {
22
 
1918 aurelien 23
		RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.GET, Configuration.getServiceBaseUrl()
937 aurelien 24
				+ "/InventoryImport/" + Utilisateur.getInstance().getIdentifiantUtilisateurConsulte());
140 aurelien 25
 
26
		try {
27
			rb.sendRequest(null, new RequestCallback() {
28
 
1293 aurelien 29
				@Override
140 aurelien 30
				public void onError(Request request, Throwable exception) {
31
					// TODO Auto-generated method stub
32
 
33
				}
34
 
1293 aurelien 35
				@Override
140 aurelien 36
				public void onResponseReceived(Request request,
37
						Response response) {
38
 
39
					if(response.getText().equals("OK")) {
647 aurelien 40
						oModele.obtenirNombreObservation(null);
140 aurelien 41
					}
42
					else
43
					{
44
 
45
					}
46
 
47
				}
48
 
49
			});
50
		} catch (RequestException e) {
51
			// TODO Auto-generated catch block
52
			e.printStackTrace();
53
		}
54
 
55
	}
56
 
57
}