106,66 → 106,68 |
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(Integer.toString(str.getNbrePersonne())); |
"&cs_ce_projet=" + str.getIdProjet() + |
"&cs_ce_mere=" + str.getIdMere() + |
"&cs_guid=" + str.getGuid() + |
"&cs_truk_identifiant_alternatif=" + str.getIdAlternatif() + |
"&cs_nom=" + str.getNom() + |
"&cs_truk_nom_alternatif=" + str.getNomAlternatif() + |
"&cs_ce_type=" + str.getType() + |
"&cs_ce_truk_type_prive=" + str.getTypePrive() + |
"&cs_ce_truk_type_public=" + str.getTypePublic() + |
"&cs_adresse_01=" + str.getAdresse() + |
"&cs_adresse_02=" + str.getAdresseComplement() + |
"&cs_date_fondation=" + str.getDateFondationFormatMysql() + |
"&cs_code_postal=" + str.getCodePostal() + |
"&cs_ville=" + str.getVille() + |
"&cs_region=" + str.getRegion() + |
"&cs_pays=" + str.getPays() + |
"&cs_telephone=" + str.getTelephone() + |
"&cs_fax=" + str.getFax() + |
"&cs_truk_url=" + str.getUrl() + |
"&cs_nbre_personne=" + Integer.toString(str.getNbrePersonne()); |
if (conservation != null) { |
postDonnees += "&csc_mark_formation=" + URL.encodeComponent(conservation.getFormation()) + |
"&csc_formation=" + URL.encodeComponent(conservation.getFormationInfo()) + |
"&csc_mark_formation_interet=" + URL.encodeComponent(conservation.getFormationInteret()) + |
"&csc_truk_stockage_local=" + URL.encodeComponent(conservation.getStockageLocal()) + |
"&csc_truk_stockage_meuble=" + URL.encodeComponent(conservation.getStockageMeuble()) + |
"&csc_truk_stockage_parametre=" + URL.encodeComponent(conservation.getStockageParametre()) + |
"&csc_mark_collection_commune=" + URL.encodeComponent(conservation.getCollectionCommune()) + |
"&csc_truk_collection_autre=" + URL.encodeComponent(conservation.getCollectionAutre()) + |
"&csc_mark_acces_controle=" + URL.encodeComponent(conservation.getAccesControle()) + |
"&csc_mark_restauration=" + URL.encodeComponent(conservation.getRestauration()) + |
"&csc_truk_restauration_operation=" + URL.encodeComponent(conservation.getRestaurationOperation()) + |
"&csc_ce_materiel_conservation=" + URL.encodeComponent(conservation.getMaterielConservation()) + |
"&csc_truk_materiel_autre=" + URL.encodeComponent(conservation.getMaterielAutre()) + |
"&csc_mark_traitement=" + URL.encodeComponent(conservation.getTraitement()) + |
"&csc_truk_traitement=" + URL.encodeComponent(conservation.getTraitements()) + |
"&csc_mark_acquisition_collection=" + URL.encodeComponent(conservation.getAcquisitionCollection()) + |
"&csc_mark_acquisition_echantillon=" + URL.encodeComponent(conservation.getAcquisitionEchantillon()) + |
"&csc_mark_acquisition_traitement=" + URL.encodeComponent(conservation.getAcquisitionTraitement()) + |
"&csc_truk_acquisition_traitement_poison=" + URL.encodeComponent(conservation.getAcquisitionTraitementPoison()) + |
"&csc_truk_acquisition_traitement_insecte=" + URL.encodeComponent(conservation.getAcquisitionTraitementInsecte()); |
postDonnees += "&csc_mark_formation=" + conservation.getFormation() + |
"&csc_formation=" + conservation.getFormationInfo() + |
"&csc_mark_formation_interet=" + conservation.getFormationInteret() + |
"&csc_truk_stockage_local=" + conservation.getStockageLocal() + |
"&csc_truk_stockage_meuble=" + conservation.getStockageMeuble() + |
"&csc_truk_stockage_parametre=" + conservation.getStockageParametre() + |
"&csc_mark_collection_commune=" + conservation.getCollectionCommune() + |
"&csc_truk_collection_autre=" + conservation.getCollectionAutre() + |
"&csc_mark_acces_controle=" + conservation.getAccesControle() + |
"&csc_mark_restauration=" + conservation.getRestauration() + |
"&csc_truk_restauration_operation=" + conservation.getRestaurationOperation() + |
"&csc_ce_materiel_conservation=" + conservation.getMaterielConservation() + |
"&csc_truk_materiel_autre=" + conservation.getMaterielAutre() + |
"&csc_mark_traitement=" + conservation.getTraitement() + |
"&csc_truk_traitement=" + conservation.getTraitements() + |
"&csc_mark_acquisition_collection=" + conservation.getAcquisitionCollection() + |
"&csc_mark_acquisition_echantillon=" + conservation.getAcquisitionEchantillon() + |
"&csc_mark_acquisition_traitement=" + conservation.getAcquisitionTraitement() + |
"&csc_truk_acquisition_traitement_poison=" + conservation.getAcquisitionTraitementPoison() + |
"&csc_truk_acquisition_traitement_insecte=" + conservation.getAcquisitionTraitementInsecte(); |
} |
if (valorisation != null) { |
postDonnees += "&csv_mark_action=" + URL.encodeComponent(valorisation.getAction()) + |
"&csv_truk_action=" + URL.encodeComponent(valorisation.getActionInfo()) + |
"&csv_publication=" + URL.encodeComponent(valorisation.getPublication()) + |
"&csv_collection_autre=" + URL.encodeComponent(valorisation.getCollectionAutre()) + |
"&csv_mark_action_future=" + URL.encodeComponent(valorisation.getActionFuture()) + |
"&csv_action_future=" + URL.encodeComponent(valorisation.getActionFutureInfo()) + |
"&csv_mark_recherche=" + URL.encodeComponent(valorisation.getRecherche()) + |
"&csv_truk_recherche_provenance=" + URL.encodeComponent(valorisation.getRechercheProvenance()) + |
"&csv_truk_recherche_type=" + URL.encodeComponent(valorisation.getRechercheType()) + |
"&csv_mark_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotif()) + |
"&csv_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotifInfo()) + |
"&csv_mark_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotif()) + |
"&csv_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotifInfo()); |
postDonnees += "&csv_mark_action=" + valorisation.getAction() + |
"&csv_truk_action=" + valorisation.getActionInfo() + |
"&csv_publication=" + valorisation.getPublication() + |
"&csv_collection_autre=" + valorisation.getCollectionAutre() + |
"&csv_mark_action_future=" + valorisation.getActionFuture() + |
"&csv_action_future=" + valorisation.getActionFutureInfo() + |
"&csv_mark_recherche=" + valorisation.getRecherche() + |
"&csv_truk_recherche_provenance=" + valorisation.getRechercheProvenance() + |
"&csv_truk_recherche_type=" + valorisation.getRechercheType() + |
"&csv_mark_acces_ss_motif=" + valorisation.getAccesSansMotif() + |
"&csv_acces_ss_motif=" + valorisation.getAccesSansMotifInfo() + |
"&csv_mark_visite_avec_motif=" + valorisation.getVisiteAvecMotif() + |
"&csv_visite_avec_motif=" + valorisation.getVisiteAvecMotifInfo(); |
} |
|
|
String postDonneesEncodees = URL.encode(postDonnees); |
|
try { |
rb.sendRequest(postDonnees, new RequestCallback() { |
rb.sendRequest(postDonneesEncodees, new RequestCallback() { |
|
public void onError(Request request, Throwable exception) { |
// Gestion des exceptions déclenchées par l'exécution de la requête |
185,25 → 187,31 |
if (response.getStatusCode() != 200) { |
onErrorHTTP(request, response); |
} else { |
Information info = new Information("ajout_structure"); |
if (response.getHeader("X-DebugJrest-Data").length() != 0) { |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data")); |
if (reponseEnteteDeboguage.isArray() != null) { |
info.setDeboguages(reponseEnteteDeboguage.isArray()); |
} |
} |
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("ajout_structure", responseValue.isString().stringValue()); |
r.rafraichir(info); |
info.setMessage(responseValue.isString().stringValue()); |
} else { |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null); |
info.setDeboguage("La réponse n'est pas une chaine JSON."); |
} |
} 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 vaut null", null); |
info.setDeboguage("tLa réponse vaut null"); |
} else if (response.getText().length() == 0) { |
info.setDeboguage("tLa réponse a une taille de 0"); |
} |
} |
r.rafraichir(info); |
|
} |
} |
|
278,73 → 286,78 |
} |
} |
|
public void modifier(final Rafraichissable vues, String utilisateurId, Structure str, StructureConservation conservation, StructureValorisation valorisation) { |
public void modifier(final Rafraichissable vues, String utilisateurId, String structureId, Structure str, StructureConservation conservation, StructureValorisation valorisation) { |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + |
SERVICE_NOM + "/" + |
str.getId() |
; |
SERVICE_NOM + "/" + structureId; |
|
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_courriel=" + URL.encodeComponent(str.getCourriel()) + |
"&cs_truk_url=" + URL.encodeComponent(str.getUrl()) + |
"&cs_nbre_personne=" + URL.encodeComponent(Integer.toString(str.getNbrePersonne())) + |
"&csc_mark_formation=" + URL.encodeComponent(conservation.getFormation()) + |
"&csc_formation=" + URL.encodeComponent(conservation.getFormationInfo()) + |
"&csc_mark_formation_interet=" + URL.encodeComponent(conservation.getFormationInteret()) + |
"&csc_truk_stockage_local=" + URL.encodeComponent(conservation.getStockageLocal()) + |
"&csc_truk_stockage_meuble=" + URL.encodeComponent(conservation.getStockageMeuble()) + |
"&csc_truk_stockage_parametre=" + URL.encodeComponent(conservation.getStockageParametre()) + |
"&csc_mark_collection_commune=" + URL.encodeComponent(conservation.getCollectionCommune()) + |
"&csc_truk_collection_autre=" + URL.encodeComponent(conservation.getCollectionAutre()) + |
"&csc_mark_acces_controle=" + URL.encodeComponent(conservation.getAccesControle()) + |
"&csc_mark_restauration=" + URL.encodeComponent(conservation.getRestauration()) + |
"&csc_truk_restauration_operation=" + URL.encodeComponent(conservation.getRestaurationOperation()) + |
"&csc_ce_materiel_conservation=" + URL.encodeComponent(conservation.getMaterielConservation()) + |
"&csc_truk_materiel_autre=" + URL.encodeComponent(conservation.getMaterielAutre()) + |
"&csc_mark_traitement=" + URL.encodeComponent(conservation.getTraitement()) + |
"&csc_truk_traitement=" + URL.encodeComponent(conservation.getTraitements()) + |
"&csc_mark_acquisition_collection=" + URL.encodeComponent(conservation.getAcquisitionCollection()) + |
"&csc_mark_acquisition_echantillon=" + URL.encodeComponent(conservation.getAcquisitionEchantillon()) + |
"&csc_mark_acquisition_traitement=" + URL.encodeComponent(conservation.getAcquisitionTraitement()) + |
"&csc_truk_acquisition_traitement_poison=" + URL.encodeComponent(conservation.getAcquisitionTraitementPoison()) + |
"&csc_truk_acquisition_traitement_insecte=" + URL.encodeComponent(conservation.getAcquisitionTraitementInsecte()) + |
"&csv_mark_action=" + URL.encodeComponent(valorisation.getAction()) + |
"&csv_truk_action=" + URL.encodeComponent(valorisation.getActionInfo()) + |
"&csv_publication=" + URL.encodeComponent(valorisation.getPublication()) + |
"&csv_collection_autre=" + URL.encodeComponent(valorisation.getCollectionAutre()) + |
"&csv_mark_action_future=" + URL.encodeComponent(valorisation.getActionFuture()) + |
"&csv_action_future=" + URL.encodeComponent(valorisation.getActionFutureInfo()) + |
"&csv_mark_recherche=" + URL.encodeComponent(valorisation.getRecherche()) + |
"&csv_truk_recherche_provenance=" + URL.encodeComponent(valorisation.getRechercheProvenance()) + |
"&csv_truk_recherche_type=" + URL.encodeComponent(valorisation.getRechercheType()) + |
"&csv_mark_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotif()) + |
"&csv_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotifInfo()) + |
"&csv_mark_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotif()) + |
"&csv_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotifInfo()) + |
""; |
|
String postDonnees = "cmhl_ce_modifier_par=" + utilisateurId; |
if (str != null) { |
postDonnees += "&cs_ce_projet=" + str.getIdProjet() + |
"&cs_ce_mere=" + str.getIdMere() + |
"&cs_guid=" + str.getGuid() + |
"&cs_truk_identifiant_alternatif=" + str.getIdAlternatif() + |
"&cs_nom=" + str.getNom() + |
"&cs_truk_nom_alternatif=" + str.getNomAlternatif() + |
"&cs_ce_type=" + str.getType() + |
"&cs_ce_truk_type_prive=" + str.getTypePrive() + |
"&cs_ce_truk_type_public=" + str.getTypePublic() + |
"&cs_adresse_01=" + str.getAdresse() + |
"&cs_adresse_02=" + str.getAdresseComplement() + |
"&cs_date_fondation=" + str.getDateFondationFormatMysql() + |
"&cs_code_postal=" + str.getCodePostal() + |
"&cs_ville=" + str.getVille() + |
"&cs_region=" + str.getRegion() + |
"&cs_pays=" + str.getPays() + |
"&cs_telephone=" + str.getTelephone() + |
"&cs_fax=" + str.getFax() + |
"&cs_courriel=" + str.getCourriel() + |
"&cs_truk_url=" + str.getUrl() + |
"&cs_nbre_personne=" + Integer.toString(str.getNbrePersonne()); |
} |
if (conservation != null) { |
postDonnees += "&csc_mark_formation=" + conservation.getFormation() + |
"&csc_formation=" + conservation.getFormationInfo() + |
"&csc_mark_formation_interet=" + conservation.getFormationInteret() + |
"&csc_truk_stockage_local=" + conservation.getStockageLocal() + |
"&csc_truk_stockage_meuble=" + conservation.getStockageMeuble() + |
"&csc_truk_stockage_parametre=" + conservation.getStockageParametre() + |
"&csc_mark_collection_commune=" + conservation.getCollectionCommune() + |
"&csc_truk_collection_autre=" + conservation.getCollectionAutre() + |
"&csc_mark_acces_controle=" + conservation.getAccesControle() + |
"&csc_mark_restauration=" + conservation.getRestauration() + |
"&csc_truk_restauration_operation=" + conservation.getRestaurationOperation() + |
"&csc_ce_materiel_conservation=" + conservation.getMaterielConservation() + |
"&csc_truk_materiel_autre=" + conservation.getMaterielAutre() + |
"&csc_mark_traitement=" + conservation.getTraitement() + |
"&csc_truk_traitement=" + conservation.getTraitements() + |
"&csc_mark_acquisition_collection=" + conservation.getAcquisitionCollection() + |
"&csc_mark_acquisition_echantillon=" + conservation.getAcquisitionEchantillon() + |
"&csc_mark_acquisition_traitement=" + conservation.getAcquisitionTraitement() + |
"&csc_truk_acquisition_traitement_poison=" + conservation.getAcquisitionTraitementPoison() + |
"&csc_truk_acquisition_traitement_insecte=" + conservation.getAcquisitionTraitementInsecte(); |
} |
if (valorisation != null) { |
postDonnees += "&csv_mark_action=" + valorisation.getAction() + |
"&csv_truk_action=" + valorisation.getActionInfo() + |
"&csv_publication=" + valorisation.getPublication() + |
"&csv_collection_autre=" + valorisation.getCollectionAutre() + |
"&csv_mark_action_future=" + valorisation.getActionFuture() + |
"&csv_action_future=" + valorisation.getActionFutureInfo() + |
"&csv_mark_recherche=" + valorisation.getRecherche() + |
"&csv_truk_recherche_provenance=" + valorisation.getRechercheProvenance() + |
"&csv_truk_recherche_type=" + valorisation.getRechercheType() + |
"&csv_mark_acces_ss_motif=" + valorisation.getAccesSansMotif() + |
"&csv_acces_ss_motif=" + valorisation.getAccesSansMotifInfo() + |
"&csv_mark_visite_avec_motif=" + valorisation.getVisiteAvecMotif() + |
"&csv_visite_avec_motif=" + valorisation.getVisiteAvecMotifInfo(); |
} |
|
String postDonneesEncodees = URL.encode(postDonnees); |
GWT.log(postDonnees, null); |
try { |
rb.sendRequest(postDonnees, new RequestCallback() { |
rb.sendRequest(postDonneesEncodees, new RequestCallback() { |
|
public void onError(Request request, Throwable exception) { |
// Gestion des exceptions déclenchées par l'exécution de la requête |
364,25 → 377,30 |
if (response.getStatusCode() != 200) { |
onErrorHTTP(request, response); |
} else { |
if (response.getText().length() != 0 && response.getText() != null) { |
Information info = new Information("modif_structure"); |
if (response.getHeader("X-DebugJrest-Data").length() != 0) { |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data")); |
if (reponseEnteteDeboguage.isArray() != null) { |
info.setDeboguages(reponseEnteteDeboguage.isArray()); |
} |
} |
if (response.getText() != null && response.getText().length() != 0) { |
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()); |
vues.rafraichir(info); |
info.setMessage(responseValue.isString().stringValue()); |
} else { |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null); |
info.setDeboguage("La réponse n'est pas une chaine JSON."); |
} |
} 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); |
info.setDeboguage("La réponse vaul null"); |
} else if (response.getText().length() == 0) { |
info.setDeboguage("La réponse a une taille de 0"); |
} |
} |
vues.rafraichir(info); |
} |
} |
|