Subversion Repositories eFlore/Applications.cel

Rev

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

package org.tela_botanica.client.modeles.dao;

import org.tela_botanica.client.modeles.objets.Configuration;
import org.tela_botanica.client.modeles.objets.Utilisateur;
import org.tela_botanica.client.observation.ObservationModele;

import com.google.gwt.http.client.Request;
import org.tela_botanica.client.util.RequestBuilderWithCredentials;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;

public class ImportObservationAsynchroneDAO {

        private ObservationModele oModele = null ;
        
        public ImportObservationAsynchroneDAO(ObservationModele observationModele) {
                oModele = observationModele;
        }

        public void importerObservations() {
                
                RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.GET, Configuration.getServiceBaseUrl()
                                + "/InventoryImport/" + Utilisateur.getInstance().getIdentifiantUtilisateurConsulte());

                try {
                        rb.sendRequest(null, new RequestCallback() {

                                @Override
                                public void onError(Request request, Throwable exception) {
                                        // TODO Auto-generated method stub

                                }

                                @Override
                                public void onResponseReceived(Request request,
                                                Response response) {

                                        // Attention OK n'est pas un terme à traduire ici 
                                        if(response.getText().equals("OK")) {
                                                oModele.obtenirNombreObservation(null);
                                        }
                                        else
                                        {
                                                
                                        }

                                }

                        });
                } catch (RequestException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                
        }

}