Subversion Repositories eFlore/Applications.cel

Rev

Rev 989 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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