Subversion Repositories eFlore/Applications.coel

Rev

Rev 526 | Rev 651 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 526 Rev 593
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.HashMap;
2
 
4
 
3
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.Mediateur;
4
import org.tela_botanica.client.RegistreId;
6
import org.tela_botanica.client.RegistreId;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.util.UtilDAO;
8
import org.tela_botanica.client.util.UtilDAO;
Line 24... Line 26...
24
	
26
	
25
	public PersonneAsyncDao(Rafraichissable vue) {
27
	public PersonneAsyncDao(Rafraichissable vue) {
26
		vueARafraichir = vue;
28
		vueARafraichir = vue;
Line 27... Line 29...
27
	}
29
	}
Line 28... Line 30...
28
 
30
 
29
	public void selectionner(String personneId, String projetId, String nomComplet) {
31
	public void selectionner(String personneId, String projetId, String nomComplet, final int pageCourante, int nbElements) {
30
		
32
		
31
		// Ajout des paramètres et données à selectionner dans l'URL
33
		// Ajout des paramètres et données à selectionner dans l'URL
32
		String[] parametres = new String[3];
34
		String[] parametres = new String[3];
-
 
35
		parametres[0] = (personneId == null ? "*" : personneId);
-
 
36
		parametres[1] = (projetId == null ? "*" : projetId);
-
 
37
		parametres[2] = (nomComplet == null ? "*" : nomComplet);
-
 
38
		
-
 
39
		HashMap<String, String> hmRestrictions = new HashMap<String, String>();
-
 
40
		hmRestrictions.put("start", String.valueOf(pageCourante));
-
 
41
		if (nbElements != -1)	{
33
		parametres[0] = (personneId == null ? "*" : personneId);
42
			hmRestrictions.put("limit", String.valueOf(nbElements));
34
		parametres[1] = (projetId == null ? "*" : projetId);
43
		}
35
		parametres[2] = (nomComplet == null ? "*" : nomComplet);
44
		
Line 36... Line 45...
36
		final RequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres);
45
		final RequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, hmRestrictions, "GET");
37
		try {
46
		try {
Line 61... Line 70...
61
							// Si la requête est un succès, reception d'un tableau
70
							// Si la requête est un succès, reception d'un tableau
62
							if (responseValue.isArray() != null) {
71
							if (responseValue.isArray() != null) {
63
								final JSONArray reponse = responseValue.isArray();
72
								final JSONArray reponse = responseValue.isArray();
64
								// Transformation du tableau JSON réponse en ListeInstitution
73
								// Transformation du tableau JSON réponse en ListeInstitution
65
								Information info = new Information("liste_personne");
74
								Information info = new Information("liste_personne");
-
 
75
								PersonneListe personnes;
-
 
76
								if (reponse.get(0).isArray() != null)	{
66
								PersonneListe personnes = new PersonneListe(reponse);
77
									personnes = new PersonneListe(reponse);
-
 
78
								}	else	{
-
 
79
									personnes = new PersonneListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
67
								
80
								}
-
 
81
								personnes.setPageCourante(pageCourante);							
68
								info.setDonnee(0, personnes);
82
								info.setDonnee(0, personnes);
69
								// et on met à jour le demandeur des données
83
								// et on met à jour le demandeur des données
-
 
84
								System.out.println("PADAO.82"+vueARafraichir);
70
								vueARafraichir.rafraichir(info);
85
								vueARafraichir.rafraichir(info);
71
							} else {
86
							} else {
72
								GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
87
								GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null);
73
							}
88
							}
74
						} else {
89
						} else {
Line 97... Line 112...
97
		// Ajout des paramètres et données à supprimer dans l'URL
112
		// Ajout des paramètres et données à supprimer dans l'URL
98
		String[] parametres =  new String[2];
113
		String[] parametres =  new String[2];
99
		parametres[0] = utilisateurId;
114
		parametres[0] = utilisateurId;
100
		parametres[1] = structureId;
115
		parametres[1] = structureId;
Line 101... Line -...
101
		
-
 
Line 102... Line 116...
102
		//System.out.println(structureId);
116
		
Line 103... Line 117...
103
		
117
		
104
		RequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, "POST");
118
		RequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, "POST");