108,7 → 108,7 |
"&cs_ce_truk_type_public =" + URL.encodeComponent(str.getTypePublic()) + |
"&cs_adresse_01 =" + URL.encodeComponent(str.getAdresse()) + |
"&cs_adresse_02 =" + URL.encodeComponent(str.getAdresseComplement()) + |
"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondation()) + |
"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondationFormatMysql()) + |
"&cs_code_postal =" + URL.encodeComponent(str.getCodePostal()) + |
"&cs_ville =" + URL.encodeComponent(str.getVille()) + |
"&cs_region =" + URL.encodeComponent(str.getRegion()) + |
232,4 → 232,86 |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête."); |
} |
} |
|
public void modifier(final Rafraichissable r, String utilisateurId, Structure str) { |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + |
"CoelStructureListe/" + |
str.getId() |
; |
|
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url); |
|
String postDonnees = "cmhl_ce_modifier_par=" + utilisateurId + |
"&cs_ce_projet =" + URL.encodeComponent(str.getIdProjet()) + |
"&cs_ce_mere =" + URL.encodeComponent(str.getIdMere()) + |
"&cs_guid =" + URL.encodeComponent(str.getGuid()) + |
"&cs_truk_identifiant_alternatif =" + URL.encodeComponent(str.getIdAlternatif()) + |
"&cs_nom=" + URL.encodeComponent(str.getNom()) + |
"&cs_truk_nom_alternatif =" + URL.encodeComponent(str.getNomAlternatif()) + |
"&cs_ce_type =" + URL.encodeComponent(str.getType()) + |
"&cs_ce_truk_type_prive =" + URL.encodeComponent(str.getTypePrive()) + |
"&cs_ce_truk_type_public =" + URL.encodeComponent(str.getTypePublic()) + |
"&cs_adresse_01 =" + URL.encodeComponent(str.getAdresse()) + |
"&cs_adresse_02 =" + URL.encodeComponent(str.getAdresseComplement()) + |
"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondationFormatMysql()) + |
"&cs_code_postal =" + URL.encodeComponent(str.getCodePostal()) + |
"&cs_ville =" + URL.encodeComponent(str.getVille()) + |
"&cs_region =" + URL.encodeComponent(str.getRegion()) + |
"&cs_pays =" + URL.encodeComponent(str.getPays()) + |
"&cs_telephone =" + URL.encodeComponent(str.getTelephone()) + |
"&cs_fax =" + URL.encodeComponent(str.getFax()) + |
"&cs_truk_url =" + URL.encodeComponent(str.getUrl()) + |
"&cs_nbre_personne =" + URL.encodeComponent(str.getNbrePersonne()) + |
""; |
|
try { |
rb.sendRequest(postDonnees, new RequestCallback() { |
|
public void onError(Request request, Throwable exception) { |
// Gestion des exceptions déclenchées par l'exécution de la requête |
GWT.log("Erreur à l'exécution du service CoelStructureListe (modif)", exception); |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de l'exécution de la requête."); |
} |
|
public void onErrorHTTP(Request request, Response reponse) { |
// Gestion des erreurs HTTP renvoyé par Apache ou JRest |
Information info = new Information("erreur_jrest", JSONParser.parse(reponse.getText()).isArray()); |
GWT.log("Erreur JREST - Code "+reponse.getStatusCode()+"\n"+info.getMessages().toString(), null); |
Info.display("Erreur JREST - Code "+reponse.getStatusCode(), info.toString()); |
} |
|
public void onResponseReceived(Request request, Response response) { |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP |
if (response.getStatusCode() != 200) { |
onErrorHTTP(request, response); |
} else { |
if (response.getText().length() != 0 && response.getText() != null) { |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
|
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
Information info = new Information("modif_structure", responseValue.isString().stringValue()); |
r.rafraichir(info); |
} else { |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} else { |
GWT.log(url, null); |
if (response.getText().length() == 0) { |
GWT.log("\tLa réponse a une taille de 0", null); |
} |
if (response.getText() == null) { |
GWT.log("\tLa réponse vaul null", null); |
} |
} |
} |
} |
|
}) ; |
} catch (RequestException e) { |
// Gestion des exceptions déclenchées par la création de la requête (url non-valide ?) |
GWT.log("Erreur à la création du service CoelProjetsListe", e); |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête."); |
} |
} |
} |