Subversion Repositories eFlore/Applications.coel

Rev

Rev 306 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 306 Rev 381
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
public class StructureAsyncDao {
20
public class StructureAsyncDao {
Line 21... Line 21...
21
	
21
	
22
	private static final String SERVICE_NOM = "CoelStructure";
22
	private static final String SERVICE_NOM = "CoelStructure";
23
	
23
	
24
	public void selectionner(final Rafraichissable vue, final String projetId, final String structureId) {
24
	public void selectionner(final Rafraichissable vueARafraichir, final String projetId, final String structureId) {
25
		// Ajout des paramètres et données à selectionner dans l'URL
25
		// Ajout des paramètres et données à selectionner dans l'URL
26
		final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + 
26
		final String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl() + 
Line 55... Line 55...
55
							final JSONValue responseValue = JSONParser.parse(response.getText());
55
							final JSONValue responseValue = JSONParser.parse(response.getText());
Line 56... Line 56...
56
		
56
		
57
							// Si la requête est un succès, reception d'un objet ou d'un tableau
57
							// Si la requête est un succès, reception d'un objet ou d'un tableau
58
							if (responseValue.isObject() != null) {
58
							if (responseValue.isObject() != null) {
59
								final JSONObject reponse = responseValue.isObject();
-
 
60
								// Transformation du tableau JSON réponse en ListeInstitution
59
								final JSONObject reponse = responseValue.isObject();
61
								Structure structure = new Structure(reponse);
60
								Structure structure = new Structure(reponse);
62
								StructureConservation structureConservation = new StructureConservation(reponse);
61
								StructureConservation structureConservation = new StructureConservation(reponse);
63
								StructureValorisation structureValorisation = new StructureValorisation(reponse);
62
								StructureValorisation structureValorisation = new StructureValorisation(reponse);
64
								Information info = new Information("selection_structure");
63
								Information info = new Information("selection_structure");
65
								info.setDonnee(0, structure);
64
								info.setDonnee(0, structure);
66
								info.setDonnee(1, structureConservation);
65
								info.setDonnee(1, structureConservation);
67
								info.setDonnee(2, structureValorisation);
66
								info.setDonnee(2, structureValorisation);
68
								vue.rafraichir(info);
67
								vueARafraichir.rafraichir(info);
69
							} else if (responseValue.isArray() != null) {
68
							} else if (responseValue.isArray() != null) {
70
								final JSONArray reponse = responseValue.isArray();
-
 
71
								// Transformation du tableau JSON réponse en ListeInstitution
69
								final JSONArray reponse = responseValue.isArray();
72
								StructureListe structures = new StructureListe(reponse);
-
 
73
								// et on met à jour le demandeur des données
70
								StructureListe structures = new StructureListe(reponse);
74
								vue.rafraichir(structures);
71
								vueARafraichir.rafraichir(structures);
75
							} else {
72
							} else {
76
								GWT.log(url+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
73
								GWT.log(url+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
77
							}
74
							}
78
						} else {
75
						} else {
79
							if (structureId == null) {
76
							if (structureId == null) {
80
								// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
77
								// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
81
								StructureListe structures = new StructureListe(0);
78
								StructureListe structures = new StructureListe(0);
82
								vue.rafraichir(structures);								
79
								vueARafraichir.rafraichir(structures);								
83
							} else {
80
							} else {
84
								GWT.log(url, null);
81
								GWT.log(url, null);
85
								if (response.getText().length() == 0) {
82
								if (response.getText().length() == 0) {
86
									GWT.log("\tLa réponse a une taille de 0", null);
83
									GWT.log("\tLa réponse a une taille de 0", null);