Rev 145 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.modeles;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.observation.ObservationModele;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Window;
public class TransmissionObservationAsynchroneDAO {
ObservationModele om = null ;
public TransmissionObservationAsynchroneDAO(ObservationModele observationModele) {
om = observationModele ;
}
public void transmettreObservations(final Rafraichissable r, String identifiant, String idsObs, boolean publier) {
// on envoie le get asynchrone
String post = "&transmission=";
if(publier) {
post += "1";
}
else
{
post += "0" ;
}
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,Configuration.getServiceBaseUrl()
+"/InventoryTransmit/"+om.getIdentifiant()+"/"+idsObs) ;
try {
rb.sendRequest(post, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// TODO Auto-generated method stub
}
public void onResponseReceived(Request request,
Response response) {
r.rafraichir("OK",true);
}
}) ;
} catch (RequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}