Subversion Repositories eFlore/Applications.del

Rev

Rev 501 | Rev 768 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
392 aurelien 1
package org.tela_botanica.del.client.services.rest;
2
 
3
import org.tela_botanica.del.client.modeles.InformationsRecherche;
4
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
5
import org.tela_botanica.del.client.services.rest.async.ObservationsCallback;
6
 
7
import com.google.gwt.http.client.RequestBuilder;
8
 
9
public class ObservationServiceConcret implements ObservationService {
445 benjamin 10
 
501 aurelien 11
	private String serverUrl = "/del/jrest/";
392 aurelien 12
 
13
	@Override
521 aurelien 14
	public void getObservations(InformationsRecherche infos, int debut, int fin, ObservationsCallback callback) {
445 benjamin 15
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Observations" + assemblerChaineRequete(infos, debut, fin));
392 aurelien 16
		try {
17
			rb.sendRequest(null, callback);
18
		} catch (Exception e) {
19
			// TODO: handle exception
20
		}
21
	}
445 benjamin 22
 
392 aurelien 23
	private String assemblerChaineRequete(InformationsRecherche infos, int debut, int fin) {
445 benjamin 24
 
25
		String chaineRequete = "?debut=" + debut + "&limite=" + (fin - debut);
474 aurelien 26
		chaineRequete+= infos.versChaineRequete();
445 benjamin 27
 
392 aurelien 28
		return chaineRequete;
29
	}
30
}