Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1329 Rev 1367
Line 6... Line 6...
6
import org.tela_botanica.client.RegistreId;
6
import org.tela_botanica.client.RegistreId;
7
import org.tela_botanica.client.http.JsonRestRequestBuilder;
7
import org.tela_botanica.client.http.JsonRestRequestBuilder;
8
import org.tela_botanica.client.http.JsonRestRequestCallback;
8
import org.tela_botanica.client.http.JsonRestRequestCallback;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.modeles.Information;
10
import org.tela_botanica.client.modeles.Information;
-
 
11
import org.tela_botanica.client.synchronisation.Reponse;
11
import org.tela_botanica.client.util.UtilDAO;
12
import org.tela_botanica.client.util.UtilDAO;
Line 12... Line 13...
12
 
13
 
13
import com.extjs.gxt.ui.client.Registry;
14
import com.extjs.gxt.ui.client.Registry;
14
import com.google.gwt.core.client.GWT;
15
import com.google.gwt.core.client.GWT;
Line 21... Line 22...
21
	
22
	
22
	private String utilisateurId = null;
23
	private String utilisateurId = null;
Line 23... Line 24...
23
	private Rafraichissable vueARafraichir = null;
24
	private Rafraichissable vueARafraichir = null;
-
 
25
	
24
	
26
	public CommentaireAsyncDao(Rafraichissable vueARafraichirCourrante) {
25
	public CommentaireAsyncDao(Rafraichissable vueARafraichirCourrante) {
27
		if (Mediateur.DEBUG) System.out.println("|| CommentaireAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString());
26
		vueARafraichir = vueARafraichirCourrante ;
28
		vueARafraichir = vueARafraichirCourrante ;
Line 27... Line 29...
27
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
29
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
28
	}
30
	}
Line 29... Line 31...
29
 
31
 
30
	public void selectionner(final String commentaireId, String projetId, String titre, final int pageCourante, final int nbElements) {
32
	public void selectionner(final String commentaireId, String projetId, String titre, final int pageCourante, final int nbElements, final Integer seqId) {
31
		String[] parametres = {projetId, commentaireId, titre};
33
		String[] parametres = {projetId, commentaireId, titre};
Line 49... Line 51...
49
					if (responseArray.get(1).isObject() != null) {
51
					if (responseArray.get(1).isObject() != null) {
50
						final JSONObject reponse = responseArray.get(1).isObject();
52
						final JSONObject reponse = responseArray.get(1).isObject();
51
						// Transformation du tableau JSON réponse en ListeInstitution
53
						// Transformation du tableau JSON réponse en ListeInstitution
52
						Commentaire commentaire = new Commentaire(reponse);
54
						Commentaire commentaire = new Commentaire(reponse);
53
						// et on met à jour le demandeur des données
55
						// et on met à jour le demandeur des données
-
 
56
						if (seqId != null)	{
-
 
57
							Reponse reponseRequete = new Reponse(commentaire, seqId);
-
 
58
							vueARafraichir.rafraichir(reponseRequete);
-
 
59
						}
-
 
60
						else	{
54
						vueARafraichir.rafraichir(commentaire);
61
							vueARafraichir.rafraichir(commentaire);
-
 
62
						}			
55
					} else if (responseValue.isArray() != null) {
63
					} else if (responseValue.isArray() != null) {
56
						final JSONArray reponse = responseValue.isArray();						
64
						final JSONArray reponse = responseValue.isArray();						
57
						CommentaireListe commentaires;
65
						CommentaireListe commentaires;
58
						if (reponse.get(1).isObject() != null)	{
66
						if (reponse.get(1).isObject() != null)	{
59
							commentaires = new CommentaireListe(reponse.get(1).isArray());
67
							commentaires = new CommentaireListe(reponse.get(1).isArray());
Line 61... Line 69...
61
							commentaires = new CommentaireListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
69
							commentaires = new CommentaireListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
62
						}
70
						}
63
						commentaires.setTaillePage(nbElements);
71
						commentaires.setTaillePage(nbElements);
64
						commentaires.setPageCourante(pageCourante);							
72
						commentaires.setPageCourante(pageCourante);							
Line -... Line 73...
-
 
73
 
-
 
74
						if (seqId != null)	{
-
 
75
							Reponse reponseRequete = new Reponse(commentaires, seqId);
-
 
76
							vueARafraichir.rafraichir(reponseRequete);
-
 
77
						}
65
 
78
						else	{
-
 
79
							vueARafraichir.rafraichir(commentaires);
66
						vueARafraichir.rafraichir(commentaires);
80
						}						
67
					} else {
81
					} else {
68
						GWT.log("La réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
82
						GWT.log("La réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
69
					}
83
					}
70
				} else {
84
				} else {
71
					// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide
85
					// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide
72
					if (commentaireId == null) {
86
					if (commentaireId == null) {
-
 
87
						CommentaireListe commentaires = new CommentaireListe(0);
-
 
88
						if (seqId != null)	{
-
 
89
							Reponse reponseRequete = new Reponse(commentaires, seqId);
-
 
90
							vueARafraichir.rafraichir(reponseRequete);
-
 
91
						}
73
						CommentaireListe commentaires = new CommentaireListe(0);
92
						else	{
-
 
93
							vueARafraichir.rafraichir(commentaires);
74
						vueARafraichir.rafraichir(commentaires);
94
						}			
75
					}
95
					}
76
				}
96
				}
77
			}
97
			}
78
		});
98
		});