Line 47... |
Line 47... |
47 |
public void onResponseReceived(Request request, Response response) {
|
47 |
public void onResponseReceived(Request request, Response response) {
|
48 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
48 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
49 |
if (response.getStatusCode() != 200) {
|
49 |
if (response.getStatusCode() != 200) {
|
50 |
onErrorHTTP(request, response);
|
50 |
onErrorHTTP(request, response);
|
51 |
} else {
|
51 |
} else {
|
- |
|
52 |
Information info = new Information("liste_structure_a_personne");
|
- |
|
53 |
if (response.getHeader("X-DebugJrest-Data") != null && response.getHeader("X-DebugJrest-Data").length() != 0) {
|
- |
|
54 |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data"));
|
- |
|
55 |
if (reponseEnteteDeboguage.isArray() != null) {
|
- |
|
56 |
info.setDeboguages(reponseEnteteDeboguage.isArray());
|
- |
|
57 |
GWT.log("DEBOGUAGE:\n"+info.getDeboguages().toString(), null);
|
- |
|
58 |
}
|
- |
|
59 |
}
|
52 |
if (response.getText().length() != 0 && response.getText() != null) {
|
60 |
if (response.getText().length() != 0 && response.getText() != null) {
|
53 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
61 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
Line 54... |
Line 62... |
54 |
|
62 |
|
55 |
// Si la requête est un succès, reception d'un tableau
|
63 |
// Si la requête est un succès, reception d'un tableau
|
56 |
if (responseValue.isArray() != null) {
|
64 |
if (responseValue.isArray() != null) {
|
57 |
final JSONArray reponse = responseValue.isArray();
|
65 |
final JSONArray reponse = responseValue.isArray();
|
58 |
// Transformation du tableau JSON réponse en ListeInstitution
|
- |
|
59 |
Information info = new Information("liste_structure_a_personne");
|
66 |
// Transformation du tableau JSON réponse en ListeInstitution
|
60 |
StructureAPersonneListe personnel = new StructureAPersonneListe(reponse);
|
67 |
StructureAPersonneListe personnel = new StructureAPersonneListe(reponse);
|
61 |
info.setDonnee(0, personnel);
|
68 |
info.setDonnee(0, personnel);
|
62 |
// et on met à jour le demandeur des données
|
69 |
// et on met à jour le demandeur des données
|
63 |
vueARafraichir.rafraichir(info);
|
70 |
vueARafraichir.rafraichir(info);
|
64 |
} else {
|
71 |
} else {
|
65 |
GWT.log(url+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
|
72 |
GWT.log(url+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
|
66 |
}
|
73 |
}
|
67 |
} else {
|
74 |
} else {
|
68 |
if (idStructure == null) {
|
75 |
if (idStructure == null) {
|
69 |
// Dans le cas, où nous demandons toutes les relations Structure à Personne et qu'il n'y en a pas, nous retournons un message d'information
|
- |
|
70 |
Information info = new Information("liste_structure_a_personne");
|
76 |
// Dans le cas, où nous demandons toutes les relations Structure à Personne et qu'il n'y en a pas, nous retournons un message d'information
|
71 |
info.setMessage("Aucun personnel");
|
77 |
info.setMessage("Aucun personnel");
|
72 |
vueARafraichir.rafraichir(info);
|
78 |
vueARafraichir.rafraichir(info);
|
73 |
} else {
|
79 |
} else {
|
74 |
GWT.log(url, null);
|
80 |
GWT.log(url, null);
|
Line 116... |
Line 122... |
116 |
public void onResponseReceived(Request request, Response response) {
|
122 |
public void onResponseReceived(Request request, Response response) {
|
117 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
123 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
118 |
if (response.getStatusCode() != 200) {
|
124 |
if (response.getStatusCode() != 200) {
|
119 |
onErrorHTTP(request, response);
|
125 |
onErrorHTTP(request, response);
|
120 |
} else {
|
126 |
} else {
|
- |
|
127 |
Information info = new Information("ajout_structure_a_personne");
|
- |
|
128 |
if (response.getHeader("X-DebugJrest-Data") != null && response.getHeader("X-DebugJrest-Data").length() != 0) {
|
- |
|
129 |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data"));
|
- |
|
130 |
if (reponseEnteteDeboguage.isArray() != null) {
|
- |
|
131 |
info.setDeboguages(reponseEnteteDeboguage.isArray());
|
- |
|
132 |
GWT.log("DEBOGUAGE:\n"+info.getDeboguages().toString(), null);
|
- |
|
133 |
}
|
- |
|
134 |
}
|
121 |
if (response.getText().length() != 0 && response.getText() != null) {
|
135 |
if (response.getText().length() != 0 && response.getText() != null) {
|
122 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
136 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
Line 123... |
Line 137... |
123 |
|
137 |
|
124 |
// Si la requête est un succès, reception d'une chaine
|
138 |
// Si la requête est un succès, reception d'une chaine
|
125 |
if (responseValue.isString() != null) {
|
139 |
if (responseValue.isString() != null) {
|
126 |
Information info = new Information("ajout_structure_a_personne", responseValue.isString().stringValue());
|
140 |
info.setMessage(responseValue.isString().stringValue());
|
127 |
vue.rafraichir(info);
|
141 |
vue.rafraichir(info);
|
128 |
} else {
|
142 |
} else {
|
129 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
143 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
130 |
}
|
144 |
}
|
Line 146... |
Line 160... |
146 |
GWT.log("Erreur à la création du service "+SERVICE_NOM+" (ajout)", e);
|
160 |
GWT.log("Erreur à la création du service "+SERVICE_NOM+" (ajout)", e);
|
147 |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête.");
|
161 |
Info.display("Erreur de Requête", "Une erreur s'est produite lors de la création de la requête.");
|
148 |
}
|
162 |
}
|
149 |
}
|
163 |
}
|
Line 150... |
Line 164... |
150 |
|
164 |
|
151 |
public void modifier(final Rafraichissable vue, String utilisateurId, StructureAPersonne personnel) {
|
165 |
public void modifier(final Rafraichissable vueARafraichir, String utilisateurId, StructureAPersonne personnel) {
|
152 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
166 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
153 |
SERVICE_NOM + "/" +
|
167 |
SERVICE_NOM + "/" +
|
154 |
personnel.getIdStructure() + "/" +
|
168 |
personnel.getIdStructure() + "/" +
|
155 |
personnel.getIdPersonne() + "/" +
|
169 |
personnel.getIdPersonne() + "/" +
|
Line 179... |
Line 193... |
179 |
public void onResponseReceived(Request request, Response response) {
|
193 |
public void onResponseReceived(Request request, Response response) {
|
180 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
194 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
181 |
if (response.getStatusCode() != 200) {
|
195 |
if (response.getStatusCode() != 200) {
|
182 |
onErrorHTTP(request, response);
|
196 |
onErrorHTTP(request, response);
|
183 |
} else {
|
197 |
} else {
|
- |
|
198 |
Information info = new Information("modif_structure_a_personne");
|
- |
|
199 |
if (response.getHeader("X-DebugJrest-Data") != null && response.getHeader("X-DebugJrest-Data").length() != 0) {
|
- |
|
200 |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data"));
|
- |
|
201 |
if (reponseEnteteDeboguage.isArray() != null) {
|
- |
|
202 |
info.setDeboguages(reponseEnteteDeboguage.isArray());
|
- |
|
203 |
GWT.log("DEBOGUAGE:\n"+info.getDeboguages().toString(), null);
|
- |
|
204 |
}
|
- |
|
205 |
}
|
184 |
if (response.getText().length() != 0 && response.getText() != null) {
|
206 |
if (response.getText().length() != 0 && response.getText() != null) {
|
185 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
207 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
Line 186... |
Line 208... |
186 |
|
208 |
|
187 |
// Si la requête est un succès, reception d'une chaine
|
209 |
// Si la requête est un succès, reception d'une chaine
|
188 |
if (responseValue.isString() != null) {
|
210 |
if (responseValue.isString() != null) {
|
189 |
Information info = new Information("modif_structure_a_personne", responseValue.isString().stringValue());
|
211 |
info.setMessage(responseValue.isString().stringValue());
|
190 |
vue.rafraichir(info);
|
212 |
vueARafraichir.rafraichir(info);
|
191 |
} else {
|
213 |
} else {
|
192 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
214 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
193 |
}
|
215 |
}
|
194 |
} else {
|
216 |
} else {
|
Line 242... |
Line 264... |
242 |
public void onResponseReceived(Request request, Response response) {
|
264 |
public void onResponseReceived(Request request, Response response) {
|
243 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
265 |
// Si le code de réponse HTTP ne vaut pas 200 OK, on lance le mécanise d'erreur HTTP
|
244 |
if (response.getStatusCode() != 200) {
|
266 |
if (response.getStatusCode() != 200) {
|
245 |
onErrorHTTP(request, response);
|
267 |
onErrorHTTP(request, response);
|
246 |
} else {
|
268 |
} else {
|
- |
|
269 |
Information info = new Information("suppression_structure_a_personne");
|
- |
|
270 |
if (response.getHeader("X-DebugJrest-Data") != null && response.getHeader("X-DebugJrest-Data").length() != 0) {
|
- |
|
271 |
final JSONValue reponseEnteteDeboguage = JSONParser.parse(response.getHeader("X-DebugJrest-Data"));
|
- |
|
272 |
if (reponseEnteteDeboguage.isArray() != null) {
|
- |
|
273 |
info.setDeboguages(reponseEnteteDeboguage.isArray());
|
- |
|
274 |
GWT.log("DEBOGUAGE:\n"+info.getDeboguages().toString(), null);
|
- |
|
275 |
}
|
- |
|
276 |
}
|
247 |
if (response.getText().length() != 0 && response.getText() != null) {
|
277 |
if (response.getText().length() != 0 && response.getText() != null) {
|
248 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
278 |
final JSONValue responseValue = JSONParser.parse(response.getText());
|
Line 249... |
Line 279... |
249 |
|
279 |
|
250 |
// Si la requête est un succès, reception d'une chaine
|
280 |
// Si la requête est un succès, reception d'une chaine
|
251 |
if (responseValue.isString() != null) {
|
281 |
if (responseValue.isString() != null) {
|
252 |
Information info = new Information("suppression_structure_a_personne", responseValue.isString().stringValue());
|
282 |
info.setMessage(responseValue.isString().stringValue());
|
253 |
vue.rafraichir(info);
|
283 |
vue.rafraichir(info);
|
254 |
} else {
|
284 |
} else {
|
255 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
285 |
GWT.log(url+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
256 |
}
|
286 |
}
|
Line 278... |
Line 308... |
278 |
private String construirePost(String utilisateurId, String structureId, StructureAPersonne personnel) {
|
308 |
private String construirePost(String utilisateurId, String structureId, StructureAPersonne personnel) {
|
279 |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId);
|
309 |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId);
|
280 |
if (structureId != null) {
|
310 |
if (structureId != null) {
|
281 |
postDonnees += "&csap_id_structure=" + structureId;
|
311 |
postDonnees += "&csap_id_structure=" + structureId;
|
282 |
}
|
312 |
}
|
- |
|
313 |
if (!personnel.getIdPersonne().equals("")) {
|
283 |
postDonnees += "&csap_id_personne=" + URL.encodeComponent(personnel.getIdPersonne()) +
|
314 |
postDonnees += "&csap_id_personne=" + URL.encodeComponent(personnel.getIdPersonne()) +
|
- |
|
315 |
"&cp_id_personne=" + URL.encodeComponent(personnel.getIdPersonne());
|
- |
|
316 |
}
|
284 |
"&csap_id_role=" + URL.encodeComponent(personnel.getIdRole()) +
|
317 |
postDonnees += "&csap_id_role=" + URL.encodeComponent(personnel.getIdRole()) +
|
285 |
"&csap_ce_truk_fonction=" + URL.encodeComponent(personnel.getFonction()) +
|
318 |
"&csap_ce_truk_fonction=" + URL.encodeComponent(personnel.getFonction()) +
|
286 |
"&csap_service=" + URL.encodeComponent(personnel.getService()) +
|
319 |
"&csap_service=" + URL.encodeComponent(personnel.getService()) +
|
287 |
"&csap_ce_truk_statut=" + URL.encodeComponent(personnel.getStatut()) +
|
320 |
"&csap_ce_truk_statut=" + URL.encodeComponent(personnel.getStatut()) +
|
288 |
"&csap_mark_contact=" + URL.encodeComponent(personnel.getContact()) +
|
321 |
"&csap_mark_contact=" + URL.encodeComponent(personnel.getContact()) +
|
289 |
"&csap_bota_travail_hebdo_tps=" + URL.encodeComponent(personnel.getBotaTravailHebdoTps()) +
|
322 |
"&csap_bota_travail_hebdo_tps=" + URL.encodeComponent(personnel.getBotaTravailHebdoTps()) +
|
- |
|
323 |
"&cp_ce_projet=" + URL.encodeComponent(personnel.getIdProjetPersonne()) +
|
290 |
"&cp_prenom=" + URL.encodeComponent(personnel.getPrenom()) +
|
324 |
"&cp_prenom=" + URL.encodeComponent(personnel.getPrenom()) +
|
291 |
"&cp_nom=" + URL.encodeComponent(personnel.getNom()) +
|
325 |
"&cp_nom=" + URL.encodeComponent(personnel.getNom()) +
|
292 |
"&cp_truk_telephone=" + URL.encodeComponent(personnel.getTelephone()) +
|
326 |
"&cp_truk_telephone=" + URL.encodeComponent(personnel.getTelephone()) +
|
293 |
"&cp_truk_courriel=" + URL.encodeComponent(personnel.getCourriel()) +
|
327 |
"&cp_truk_courriel=" + URL.encodeComponent(personnel.getCourriel()) +
|
294 |
"&cp_ce_truk_specialite=" + URL.encodeComponent(personnel.getSpecialite()) +
|
328 |
"&cp_ce_truk_specialite=" + URL.encodeComponent(personnel.getSpecialite()) +
|