Subversion Repositories eFlore/Applications.coel

Rev

Rev 156 | Rev 177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 169
Line 106... Line 106...
106
			"&cs_ce_type =" + URL.encodeComponent(str.getType()) +
106
			"&cs_ce_type =" + URL.encodeComponent(str.getType()) +
107
			"&cs_ce_truk_type_prive =" + URL.encodeComponent(str.getTypePrive()) +
107
			"&cs_ce_truk_type_prive =" + URL.encodeComponent(str.getTypePrive()) +
108
			"&cs_ce_truk_type_public =" + URL.encodeComponent(str.getTypePublic()) +
108
			"&cs_ce_truk_type_public =" + URL.encodeComponent(str.getTypePublic()) +
109
			"&cs_adresse_01 =" + URL.encodeComponent(str.getAdresse()) +
109
			"&cs_adresse_01 =" + URL.encodeComponent(str.getAdresse()) +
110
			"&cs_adresse_02 =" + URL.encodeComponent(str.getAdresseComplement()) +
110
			"&cs_adresse_02 =" + URL.encodeComponent(str.getAdresseComplement()) +
111
			"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondation()) +
111
			"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondationFormatMysql()) +
112
			"&cs_code_postal =" + URL.encodeComponent(str.getCodePostal()) +
112
			"&cs_code_postal =" + URL.encodeComponent(str.getCodePostal()) +
113
			"&cs_ville =" + URL.encodeComponent(str.getVille()) +
113
			"&cs_ville =" + URL.encodeComponent(str.getVille()) +
114
			"&cs_region =" + URL.encodeComponent(str.getRegion()) +
114
			"&cs_region =" + URL.encodeComponent(str.getRegion()) +
115
			"&cs_pays =" + URL.encodeComponent(str.getPays()) +
115
			"&cs_pays =" + URL.encodeComponent(str.getPays()) +
116
			"&cs_telephone =" + URL.encodeComponent(str.getTelephone()) +
116
			"&cs_telephone =" + URL.encodeComponent(str.getTelephone()) +
Line 230... Line 230...
230
			// Gestion des exceptions déclenchées par la création de la requête (url non-valide ?)
230
			// Gestion des exceptions déclenchées par la création de la requête (url non-valide ?)
231
			GWT.log("Erreur à la création du service CoelProjetsListe", e);
231
			GWT.log("Erreur à la création du service CoelProjetsListe", e);
232
			Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête.");
232
			Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête.");
233
		}
233
		}
234
	}
234
	}
-
 
235
 
-
 
236
	public void modifier(final Rafraichissable r, String utilisateurId, Structure str) {
-
 
237
		final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + 
-
 
238
		"CoelStructureListe/" +
-
 
239
		str.getId()
-
 
240
		;
-
 
241
	
-
 
242
		RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
-
 
243
		
-
 
244
		String postDonnees = 	"cmhl_ce_modifier_par=" + utilisateurId +
-
 
245
			"&cs_ce_projet =" + URL.encodeComponent(str.getIdProjet()) +
-
 
246
			"&cs_ce_mere =" + URL.encodeComponent(str.getIdMere()) +
-
 
247
			"&cs_guid =" + URL.encodeComponent(str.getGuid()) +
-
 
248
			"&cs_truk_identifiant_alternatif =" + URL.encodeComponent(str.getIdAlternatif()) +
-
 
249
			"&cs_nom=" + URL.encodeComponent(str.getNom()) +
-
 
250
			"&cs_truk_nom_alternatif =" + URL.encodeComponent(str.getNomAlternatif()) +
-
 
251
			"&cs_ce_type =" + URL.encodeComponent(str.getType()) +
-
 
252
			"&cs_ce_truk_type_prive =" + URL.encodeComponent(str.getTypePrive()) +
-
 
253
			"&cs_ce_truk_type_public =" + URL.encodeComponent(str.getTypePublic()) +
-
 
254
			"&cs_adresse_01 =" + URL.encodeComponent(str.getAdresse()) +
-
 
255
			"&cs_adresse_02 =" + URL.encodeComponent(str.getAdresseComplement()) +
-
 
256
			"&cs_date_fondation =" + URL.encodeComponent(str.getDateFondationFormatMysql()) +
-
 
257
			"&cs_code_postal =" + URL.encodeComponent(str.getCodePostal()) +
-
 
258
			"&cs_ville =" + URL.encodeComponent(str.getVille()) +
-
 
259
			"&cs_region =" + URL.encodeComponent(str.getRegion()) +
-
 
260
			"&cs_pays =" + URL.encodeComponent(str.getPays()) +
-
 
261
			"&cs_telephone =" + URL.encodeComponent(str.getTelephone()) +
-
 
262
			"&cs_fax =" + URL.encodeComponent(str.getFax()) +
-
 
263
			"&cs_truk_url =" + URL.encodeComponent(str.getUrl()) +
-
 
264
			"&cs_nbre_personne =" + URL.encodeComponent(str.getNbrePersonne()) +
-
 
265
			"";
-
 
266
	
-
 
267
		try {
-
 
268
			rb.sendRequest(postDonnees, new RequestCallback() {
-
 
269
	
-
 
270
				public void onError(Request request, Throwable exception) {
-
 
271
					// Gestion des exceptions déclenchées par l'exécution de la requête 
-
 
272
					GWT.log("Erreur à l'exécution du service CoelStructureListe (modif)", exception);
-
 
273
					Info.display("Erreur de Requête", "Une erreur s'est produite lors de l'exécution de la requête.");
-
 
274
				}
-
 
275
				
-
 
276
				public void onErrorHTTP(Request request, Response reponse) {
-
 
277
					// Gestion des erreurs HTTP renvoyé par Apache ou JRest 
-
 
278
					Information info = new Information("erreur_jrest", JSONParser.parse(reponse.getText()).isArray());
-
 
279
					GWT.log("Erreur JREST - Code "+reponse.getStatusCode()+"\n"+info.getMessages().toString(), null);
-
 
280
					Info.display("Erreur JREST - Code "+reponse.getStatusCode(), info.toString());
-
 
281
				}
-
 
282
	
-
 
283
				public void onResponseReceived(Request request, Response response) {
-
 
284
					// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
-
 
285
					if (response.getStatusCode() != 200) {
-
 
286
						onErrorHTTP(request, response);
-
 
287
					} else {
-
 
288
						if (response.getText().length() != 0 && response.getText() != null) {
-
 
289
							final JSONValue responseValue = JSONParser.parse(response.getText());
-
 
290
							
-
 
291
							// Si la requête est un succès, reception d'une chaine
-
 
292
							if (responseValue.isString() != null) {
-
 
293
								Information info = new Information("modif_structure", responseValue.isString().stringValue());
-
 
294
								r.rafraichir(info);
-
 
295
							} else {
-
 
296
								GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
-
 
297
							}
-
 
298
						} else {
-
 
299
							GWT.log(url, null);
-
 
300
							if (response.getText().length() == 0) {
-
 
301
								GWT.log("\tLa réponse a une taille de 0", null);
-
 
302
							}
-
 
303
							if (response.getText() == null) {
-
 
304
								GWT.log("\tLa réponse vaul null", null);
-
 
305
							}
-
 
306
						}
-
 
307
					}
-
 
308
				}
-
 
309
				
-
 
310
			}) ;
-
 
311
		} catch (RequestException e) {
-
 
312
			// Gestion des exceptions déclenchées par la création de la requête (url non-valide ?)
-
 
313
			GWT.log("Erreur à la création du service CoelProjetsListe", e);
-
 
314
			Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête.");
-
 
315
		}	
-
 
316
	}
235
}
317
}
236
318