| Line 27... |
Line 27... |
| 27 |
vueARafraichir = vueARafraichirCourrante;
|
27 |
vueARafraichir = vueARafraichirCourrante;
|
| 28 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
28 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
|
| 29 |
}
|
29 |
}
|
| Line 30... |
Line 30... |
| 30 |
|
30 |
|
| 31 |
public void selectionner(String publicationId, String personnesId, String roleId) {
|
- |
|
| 32 |
|
- |
|
| 33 |
Debug.log("|> BEGIN PublicationAPersonneAsyncDAO.selectionner(String publicationId, String personnesId, String roleId)");
|
- |
|
| 34 |
|
- |
|
| 35 |
Debug.log("|--> Requete, publicationId="+publicationId+", personnesId="+personnesId+", roleId="+roleId);
|
- |
|
| 36 |
|
31 |
public void selectionner(String publicationId, String personnesId, String roleId) {
|
| 37 |
String[] parametres = {publicationId, personnesId, roleId};
|
- |
|
| 38 |
|
- |
|
| 39 |
Debug.log("|--> Requete, SERVICE_NOM ="+SERVICE_NOM);
|
- |
|
| 40 |
Debug.log("|--> Requete, parametres ="+parametres);
|
- |
|
| 41 |
|
32 |
String[] parametres = {publicationId, personnesId, roleId};
|
| 42 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres);
|
- |
|
| 43 |
|
33 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres);
|
| 44 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
34 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
| 45 |
@Override
|
35 |
@Override
|
| 46 |
public void surReponse(JSONValue responseValue) {
|
36 |
public void surReponse(JSONValue responseValue) {
|
| 47 |
if (responseValue != null) {
|
37 |
if (responseValue != null) {
|
| 48 |
// Si la requête est un succès, réception d'un objet ou d'un tableau
|
38 |
// Si la requête est un succès, réception d'un objet ou d'un tableau
|
| 49 |
if (responseValue.isObject() != null) {
|
39 |
if (responseValue.isObject() != null) {
|
| 50 |
final JSONObject reponse = responseValue.isObject();
|
40 |
final JSONObject reponse = responseValue.isObject();
|
| 51 |
// Transformation du tableau JSON réponse en ListeInstitution
|
41 |
// Transformation du tableau JSON réponse en ListeInstitution
|
| 52 |
PublicationAPersonne publicationAPersonne = new PublicationAPersonne(reponse);
|
- |
|
| 53 |
|
- |
|
| 54 |
Debug.log("|--> PublicationAPersonneAsyncDAO.selectionner() : publicationAPersonne="+publicationAPersonne.toString());
|
- |
|
| 55 |
|
42 |
PublicationAPersonne publicationAPersonne = new PublicationAPersonne(reponse);
|
| 56 |
// et on met à jour le demandeur des données
|
43 |
// et on met à jour le demandeur des données
|
| 57 |
vueARafraichir.rafraichir(publicationAPersonne);
|
44 |
vueARafraichir.rafraichir(publicationAPersonne);
|
| 58 |
} else if (responseValue.isArray() != null) {
|
- |
|
| 59 |
|
- |
|
| 60 |
Debug.log("|--> PublicationAPersonneAsyncDAO.selectionner() : responseValue.isArray()");
|
- |
|
| 61 |
|
45 |
} else if (responseValue.isArray() != null) {
|
| 62 |
final JSONArray reponse = responseValue.isArray();
|
46 |
final JSONArray reponse = responseValue.isArray();
|
| 63 |
PublicationAPersonneListe publicationsAPersonneListe = new PublicationAPersonneListe(reponse);
|
- |
|
| 64 |
|
- |
|
| 65 |
Debug.log("|--> PublicationAPersonneAsyncDAO.selectionner() : publicationsAPersonneListe="+publicationsAPersonneListe.toString());
|
- |
|
| 66 |
Debug.log("|--> PublicationAPersonneAsyncDAO.selectionner() : appel à rafraichir(publicationsAPersonneListe)");
|
- |
|
| 67 |
|
47 |
PublicationAPersonneListe publicationsAPersonneListe = new PublicationAPersonneListe(reponse);
|
| 68 |
vueARafraichir.rafraichir(publicationsAPersonneListe);
|
48 |
vueARafraichir.rafraichir(publicationsAPersonneListe);
|
| 69 |
} else {
|
49 |
} else {
|
| 70 |
GWT.log("La réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null);
|
50 |
GWT.log("La réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null);
|
| 71 |
}
|
51 |
}
|
| 72 |
} else {
|
- |
|
| 73 |
|
- |
|
| 74 |
Debug.log("|--> PublicationAPersonneAsyncDAO.selectionner() : ELSE");
|
- |
|
| 75 |
|
52 |
} else {
|
| 76 |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide
|
53 |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide
|
| 77 |
PublicationAPersonneListe publicationAPersonneListe = new PublicationAPersonneListe(0);
|
54 |
PublicationAPersonneListe publicationAPersonneListe = new PublicationAPersonneListe(0);
|
| 78 |
vueARafraichir.rafraichir(publicationAPersonneListe);
|
55 |
vueARafraichir.rafraichir(publicationAPersonneListe);
|
| 79 |
}
|
56 |
}
|
| 80 |
}
|
57 |
}
|
| 81 |
});
|
- |
|
| 82 |
|
- |
|
| 83 |
Debug.log("|> END PublicationAPersonneAsyncDAO.selectionner(String publicationId, String personnesId, String roleId)");
|
- |
|
| 84 |
|
58 |
});
|
| Line 85... |
Line 59... |
| 85 |
}
|
59 |
}
|
| 86 |
|
- |
|
| 87 |
public void ajouter(String publicationId, String personnesId, String roleId) {
|
- |
|
| 88 |
Debug.log("<8-8> BEGIN PublicationAPersonneAsyncDao.ajouter()");
|
- |
|
| 89 |
|
- |
|
| 90 |
Debug.log("<8-8> Service_nom="+SERVICE_NOM);
|
60 |
|
| 91 |
|
61 |
public void ajouter(String publicationId, String personnesId, String roleId) {
|
| 92 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(publicationId)
|
62 |
String postDonneesEncodees = "cpuap_id_publication="+URL.encodeComponent(publicationId)
|
| 93 |
+"&cpuap_id_auteur="+URL.encodeComponent(personnesId)
|
63 |
+"&cpuap_id_auteur="+URL.encodeComponent(personnesId)
|
| 94 |
+"&cpuap_id_role="+URL.encodeComponent(roleId)
|
- |
|
| 95 |
+"&cmhl_ce_modifier_par="+utilisateurId;
|
- |
|
| 96 |
|
- |
|
| 97 |
Debug.log("<8-8> postDonneesEncodees="+postDonneesEncodees);
|
64 |
+"&cpuap_id_role="+URL.encodeComponent(roleId)
|
| 98 |
|
65 |
+"&cmhl_ce_modifier_par="+utilisateurId;
|
| 99 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
66 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
|
| 100 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
67 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
| 101 |
@Override
|
68 |
@Override
|
| 102 |
public void surReponse(JSONValue reponseValeur) {
|
69 |
public void surReponse(JSONValue reponseValeur) {
|
| 103 |
traiterReponse(reponseValeur, "ajout_publication_a_personne");
|
70 |
traiterReponse(reponseValeur, "ajout_publication_a_personne");
|
| 104 |
}
|
- |
|
| 105 |
});
|
- |
|
| 106 |
|
71 |
}
|
| Line 107... |
Line 72... |
| 107 |
Debug.log("<8-8> END PublicationAPersonneAsyncDao.ajouter()");
|
72 |
});
|
| 108 |
}
|
73 |
}
|
| Line 123... |
Line 88... |
| 123 |
});
|
88 |
});
|
| 124 |
}
|
89 |
}
|
| Line 125... |
Line 90... |
| 125 |
|
90 |
|
| 126 |
public void supprimer(String idPublicationAPersonne) {
|
91 |
public void supprimer(String idPublicationAPersonne) {
|
| 127 |
String[] parametres = {utilisateurId, idPublicationAPersonne};
|
92 |
String[] parametres = {utilisateurId, idPublicationAPersonne};
|
| 128 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
- |
|
| 129 |
|
- |
|
| 130 |
Debug.log("888> BEGIN PublicationAPersonneAsyncDao.supprimer()");
|
- |
|
| 131 |
Debug.log("888> idPublicationAPersonne="+idPublicationAPersonne);
|
- |
|
| 132 |
|
93 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
|
| 133 |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
|
94 |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
|
| 134 |
@Override
|
95 |
@Override
|
| 135 |
public void surReponse(JSONValue responseValue) {
|
96 |
public void surReponse(JSONValue responseValue) {
|
| 136 |
if (responseValue.isString() != null) {
|
97 |
if (responseValue.isString() != null) {
|
| Line 140... |
Line 101... |
| 140 |
} else {
|
101 |
} else {
|
| 141 |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
102 |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
|
| 142 |
}
|
103 |
}
|
| 143 |
}
|
104 |
}
|
| 144 |
});
|
105 |
});
|
| 145 |
|
- |
|
| 146 |
Debug.log("888> END PublicationAPersonneAsyncDao.supprimer()");
|
- |
|
| 147 |
}
|
106 |
}
|
| Line 148... |
Line 107... |
| 148 |
|
107 |
|
| 149 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
108 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
| 150 |
Information info = new Information(type);
|
109 |
Information info = new Information(type);
|