| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.modeles;
|
1 |
package org.tela_botanica.client.modeles;
|
| - |
|
2 |
import java.util.HashMap;
|
| - |
|
3 |
|
| 2 |
import org.tela_botanica.client.Mediateur;
|
4 |
import org.tela_botanica.client.Mediateur;
|
| 3 |
import org.tela_botanica.client.RegistreId;
|
5 |
import org.tela_botanica.client.RegistreId;
|
| 4 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 5 |
import org.tela_botanica.client.util.UtilDAO;
|
7 |
import org.tela_botanica.client.util.UtilDAO;
|
| Line 90... |
Line 92... |
| 90 |
}
|
92 |
}
|
| Line 91... |
Line 93... |
| 91 |
|
93 |
|
| Line 92... |
Line 94... |
| 92 |
public void supprimer(final Rafraichissable r, String structureId) {
|
94 |
public void supprimer(final Rafraichissable r, String structureId) {
|
| 93 |
|
- |
|
| - |
|
95 |
|
| 94 |
String utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
96 |
String utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
| 95 |
|
- |
|
| 96 |
// Ajout des paramètres et données à supprimer dans l'URL
|
97 |
System.out.println(utilisateurId);
|
| 97 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
98 |
// Ajout des paramètres et données à supprimer dans l'URL
|
| 98 |
SERVICE_NOM + "/" +
|
99 |
String[] parametres = new String[2];
|
| 99 |
utilisateurId + "/" +
|
- |
|
| Line 100... |
Line -... |
| 100 |
structureId +
|
- |
|
| 101 |
"";
|
100 |
parametres[0] = utilisateurId;
|
| 102 |
|
- |
|
| Line 103... |
Line 101... |
| 103 |
// DELETE n'étant pas disponible comme méthode HTTP, nous utilisons POST avec le paramètre action=DELETE
|
101 |
parametres[1] = structureId;
|
| 104 |
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
|
102 |
|
| Line 105... |
Line 103... |
| 105 |
String postDonnees = "action=DELETE";
|
103 |
RequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, "POST");
|
| 106 |
|
104 |
|
| 107 |
try {
|
105 |
try {
|
| 108 |
rb.sendRequest(postDonnees, new RequestCallback() {
|
106 |
rb.sendRequest("action=DELETE", new RequestCallback() {
|
| Line 131... |
Line 129... |
| 131 |
// Si la requête est un succès, reception d'une chaine
|
129 |
// Si la requête est un succès, reception d'une chaine
|
| 132 |
if (responseValue.isString() != null) {
|
130 |
if (responseValue.isString() != null) {
|
| 133 |
Information info = new Information("suppression_personne", responseValue.isString().stringValue());
|
131 |
Information info = new Information("suppression_personne", responseValue.isString().stringValue());
|
| 134 |
r.rafraichir(info);
|
132 |
r.rafraichir(info);
|
| 135 |
} else {
|
133 |
} else {
|
| 136 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
134 |
// GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
| 137 |
}
|
135 |
}
|
| 138 |
} else {
|
136 |
} else {
|
| 139 |
GWT.log(url, null);
|
137 |
//GWT.log(url, null);
|
| 140 |
if (response.getText().length() == 0) {
|
138 |
if (response.getText().length() == 0) {
|
| 141 |
GWT.log("\tLa réponse a une taille de 0", null);
|
139 |
GWT.log("\tLa réponse a une taille de 0", null);
|
| 142 |
}
|
140 |
}
|
| 143 |
if (response.getText() == null) {
|
141 |
if (response.getText() == null) {
|
| 144 |
GWT.log("\tLa réponse vaul null", null);
|
142 |
GWT.log("\tLa réponse vaul null", null);
|