| Line 21... |
Line 21... |
| 21 |
public PublicationAsyncDao(Rafraichissable vueARafraichirCourrante) {
|
21 |
public PublicationAsyncDao(Rafraichissable vueARafraichirCourrante) {
|
| 22 |
vueARafraichir = vueARafraichirCourrante ;
|
22 |
vueARafraichir = vueARafraichirCourrante ;
|
| 23 |
}
|
23 |
}
|
| Line 24... |
Line 24... |
| 24 |
|
24 |
|
| 25 |
public void selectionnerPublication(final String publicationId, String projetId, String nomComplet) {
|
25 |
public void selectionnerPublication(final String publicationId, String projetId, String nomComplet) {
|
| 26 |
// Ajout des paramètres et données à selectionner dans l'URL
|
26 |
// Ajout des paramètres et données à sélectionner dans l'URL
|
| 27 |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
27 |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
| 28 |
SERVICE_NOM + "/" +
|
28 |
SERVICE_NOM + "/" +
|
| 29 |
(projetId == null ? "*" : projetId) + "/" +
|
29 |
(projetId == null ? "*" : projetId) + "/" +
|
| 30 |
(publicationId == null ? "*" : publicationId) + "/" +
|
30 |
(publicationId == null ? "*" : publicationId) + "/" +
|
| Line 36... |
Line 36... |
| 36 |
|
36 |
|
| 37 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
37 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
| 38 |
@Override
|
38 |
@Override
|
| 39 |
public void surReponse(JSONValue responseValue) {
|
39 |
public void surReponse(JSONValue responseValue) {
|
| 40 |
if (responseValue != null) {
|
40 |
if (responseValue != null) {
|
| 41 |
// Si la requête est un succès, reception d'un objet ou d'un tableau
|
41 |
// Si la requête est un succès, réception d'un objet ou d'un tableau
|
| 42 |
if (responseValue.isObject() != null) {
|
42 |
if (responseValue.isObject() != null) {
|
| 43 |
final JSONObject reponse = responseValue.isObject();
|
43 |
final JSONObject reponse = responseValue.isObject();
|
| 44 |
// Transformation du tableau JSON réponse en ListeInstitution
|
44 |
// Transformation du tableau JSON réponse en ListeInstitution
|
| 45 |
Publication publication = new Publication(reponse);
|
45 |
Publication publication = new Publication(reponse);
|
| Line 76... |
Line 76... |
| 76 |
traiterReponse(reponseValeur, "publication_valide");
|
76 |
traiterReponse(reponseValeur, "publication_valide");
|
| 77 |
}
|
77 |
}
|
| 78 |
});
|
78 |
});
|
| 79 |
}
|
79 |
}
|
| Line 80... |
Line 80... |
| 80 |
|
80 |
|
| Line 81... |
Line 81... |
| 81 |
public void ajouterPublication(String utilisateurId, Publication pubAAjouter) {
|
81 |
public void ajouterPublication(String utilisateurId, Publication publication) {
|
| 82 |
|
82 |
|
| 83 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/";
|
83 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/";
|
| Line 84... |
Line 84... |
| 84 |
JsonRestRequestBuilder rb = new JsonRestRequestBuilder(RequestBuilder.POST, url);
|
84 |
JsonRestRequestBuilder rb = new JsonRestRequestBuilder(RequestBuilder.POST, url);
|
| 85 |
String postDonneesEncodees = pubAAjouter.toReqString()+"&cmhl_ce_modifier_par="+utilisateurId;
|
85 |
String postDonneesEncodees = publication.toReqString()+"&cmhl_ce_modifier_par="+utilisateurId;
|
| 86 |
|
86 |
|
| 87 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
87 |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
|
| Line 94... |
Line 94... |
| 94 |
|
94 |
|
| 95 |
public void supprimerPublication(String utilisateurId, String idPubs) {
|
95 |
public void supprimerPublication(String utilisateurId, String idPubs) {
|
| 96 |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl();
|
96 |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl();
|
| Line 97... |
Line 97... |
| 97 |
JsonRestRequestBuilder rb = new JsonRestRequestBuilder(RequestBuilder.POST, url+SERVICE_NOM+"/"+utilisateurId+"/"+idPubs);
|
97 |
JsonRestRequestBuilder rb = new JsonRestRequestBuilder(RequestBuilder.POST, url+SERVICE_NOM+"/"+utilisateurId+"/"+idPubs);
|
| 98 |
|
98 |
|
| 99 |
rb.envoyerRequete("action=DELETE", new JsonRestRequestCallback() {
|
99 |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
|
| 100 |
@Override
|
100 |
@Override
|
| 101 |
public void surReponse(JSONValue reponseValeur) {
|
101 |
public void surReponse(JSONValue reponseValeur) {
|
| 102 |
traiterReponse(reponseValeur, "suppression_publication");
|
102 |
traiterReponse(reponseValeur, "suppression_publication");
|
| 103 |
}
|
103 |
}
|
| Line 104... |
Line 104... |
| 104 |
});
|
104 |
});
|
| 105 |
}
|
105 |
}
|
| 106 |
|
106 |
|
| 107 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
107 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
| 108 |
Information info = new Information(type);
|
108 |
Information info = new Information(type);
|
| 109 |
// Si la requête est un succès, reception d'une chaine
|
109 |
// Si la requête est un succès, réception d'une chaîne
|
| 110 |
if (reponseValeur.isString() != null) {
|
110 |
if (reponseValeur.isString() != null) {
|
| 111 |
info.setDonnee(reponseValeur.isString().stringValue());
|
111 |
info.setDonnee(reponseValeur.isString().stringValue());
|