Subversion Repositories eFlore/Applications.del

Rev

Rev 491 | Rev 530 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.services.rest;

import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
import org.tela_botanica.del.client.services.rest.async.ObservationsCallback;

import com.google.gwt.http.client.RequestBuilder;

public class ObservationServiceConcret implements ObservationService {

        private String serverUrl = "/del/jrest/";

        @Override
        public ObservationServiceResultat getObservations(InformationsRecherche infos, int debut, int fin, ObservationsCallback callback) {
                RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Observations" + assemblerChaineRequete(infos, debut, fin));
                try {
                        rb.sendRequest(null, callback);
                } catch (Exception e) {
                        // TODO: handle exception
                }
                return null;
        }

        private String assemblerChaineRequete(InformationsRecherche infos, int debut, int fin) {

                String chaineRequete = "?debut=" + debut + "&limite=" + (fin - debut);
                chaineRequete+= infos.versChaineRequete();

                return chaineRequete;
        }
}