| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import org.tela_botanica.client.RegistreId;
|
3 |
import org.tela_botanica.client.RegistreId;
|
| 4 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
4 |
import org.tela_botanica.client.http.JsonRestRequestBuilder;
|
| 5 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
5 |
import org.tela_botanica.client.http.JsonRestRequestCallback;
|
| - |
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| Line 6... |
Line 7... |
| 6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
7 |
import org.tela_botanica.client.util.UtilDAO;
|
| 7 |
|
8 |
|
| 8 |
import com.extjs.gxt.ui.client.Registry;
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
| 9 |
import com.google.gwt.core.client.GWT;
|
10 |
import com.google.gwt.core.client.GWT;
|
| Line 23... |
Line 24... |
| 23 |
|
24 |
|
| 24 |
public PublicationAPersonneAsyncDao(Rafraichissable vueARafraichir) {
|
25 |
public PublicationAPersonneAsyncDao(Rafraichissable vueARafraichir) {
|
| 25 |
this.vueARafraichir = vueARafraichir;
|
26 |
this.vueARafraichir = vueARafraichir;
|
| Line 26... |
Line 27... |
| 26 |
}
|
27 |
}
|
| 27 |
|
28 |
|
| 28 |
public void selectionnerAuteurAPublication(String projetId, String idAuteurs,
|
- |
|
| 29 |
String role, String idPublication) {
|
- |
|
| 30 |
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() +
|
- |
|
| 31 |
SERVICE_NOM + "/" +
|
- |
|
| 32 |
(projetId == null ? "*" : projetId) + "/" +
|
- |
|
| 33 |
(idAuteurs == null ? "*" : idAuteurs) + "/" +
|
- |
|
| 34 |
(idPublication == null ? "*" : idPublication) + "/" +
|
- |
|
| 35 |
"";
|
- |
|
| 36 |
url = URL.encode(url);
|
29 |
public void selectionnerAuteurAPublication(String projetId, String idAuteurs, String role, String idPublication) {
|
| 37 |
|
- |
|
| 38 |
JsonRestRequestBuilder rb = new JsonRestRequestBuilder(RequestBuilder.GET, url);
|
30 |
String[] parametres = {projetId, idAuteurs, idPublication};
|
| 39 |
|
31 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres);
|
| 40 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
32 |
rb.envoyerRequete(null, new JsonRestRequestCallback() {
|
| 41 |
@Override
|
33 |
@Override
|
| 42 |
public void surReponse(JSONValue responseValue) {
|
34 |
public void surReponse(JSONValue responseValue) {
|
| 43 |
if (responseValue != null) {
|
35 |
if (responseValue != null) {
|
| 44 |
// Si la requête est un succès, reception d'un objet ou d'un tableau
|
36 |
// Si la requête est un succès, réception d'un objet ou d'un tableau
|
| 45 |
if (responseValue.isObject() != null) {
|
37 |
if (responseValue.isObject() != null) {
|
| 46 |
final JSONObject reponse = responseValue.isObject();
|
38 |
final JSONObject reponse = responseValue.isObject();
|
| 47 |
// Transformation du tableau JSON réponse en ListeInstitution
|
39 |
// Transformation du tableau JSON réponse en ListeInstitution
|
| Line 62... |
Line 54... |
| 62 |
}
|
54 |
}
|
| 63 |
}
|
55 |
}
|
| 64 |
});
|
56 |
});
|
| 65 |
}
|
57 |
}
|
| Line 66... |
Line 58... |
| 66 |
|
58 |
|
| 67 |
public void ajouterAuteur(String utilisateurid, String idAuteurs,
|
- |
|
| Line 68... |
Line 59... |
| 68 |
String role, String idPublication) {
|
59 |
public void ajouterAuteur(String utilisateurid, String idAuteurs, String role, String idPublication) {
|
| 69 |
|
60 |
|
| 70 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/";
|
61 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/";
|
| 71 |
// auteur 2360
|
62 |
// auteur 2360
|
| Line 82... |
Line 73... |
| 82 |
}
|
73 |
}
|
| 83 |
}) ;
|
74 |
}) ;
|
| 84 |
}
|
75 |
}
|
| Line 85... |
Line 76... |
| 85 |
|
76 |
|
| 86 |
|
- |
|
| 87 |
public void modifierAuteur(String utilisateurid, String idAuteurs,
|
77 |
|
| 88 |
String idPublication) {
|
78 |
public void modifierAuteur(String utilisateurid, String idAuteurs, String idPublication) {
|
| 89 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/"
|
79 |
final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl()+SERVICE_NOM+"/"
|
| 90 |
+idPublication+"/"
|
80 |
+idPublication+"/"
|
| 91 |
+idAuteurs+"/"
|
81 |
+idAuteurs+"/"
|
| Line 103... |
Line 93... |
| 103 |
}) ;
|
93 |
}) ;
|
| 104 |
}
|
94 |
}
|
| Line 105... |
Line 95... |
| 105 |
|
95 |
|
| 106 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
96 |
private void traiterReponse(JSONValue reponseValeur, String type) {
|
| 107 |
Information info = new Information(type);
|
97 |
Information info = new Information(type);
|
| 108 |
// Si la requête est un succès, reception d'une chaine
|
98 |
// Si la requête est un succès, réception d'une chaîne
|
| 109 |
if (reponseValeur.isBoolean() != null) {
|
99 |
if (reponseValeur.isBoolean() != null) {
|
| 110 |
info.setDonnee(reponseValeur.isBoolean().booleanValue());
|
100 |
info.setDonnee(reponseValeur.isBoolean().booleanValue());
|
| 111 |
} else if (reponseValeur.isString() != null) {
|
101 |
} else if (reponseValeur.isString() != null) {
|
| 112 |
info.setDonnee(reponseValeur.isString().stringValue());
|
102 |
info.setDonnee(reponseValeur.isString().stringValue());
|