Subversion Repositories eFlore/Applications.del

Rev

Rev 1367 | Rev 1467 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1367 Rev 1426
1
package org.tela_botanica.del.client.cache;
1
package org.tela_botanica.del.client.cache;
2
 
2
 
3
import java.util.List;
3
import java.util.List;
4
 
4
 
5
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
5
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
6
import org.tela_botanica.del.client.modeles.Image;
6
import org.tela_botanica.del.client.modeles.Image;
7
import org.tela_botanica.del.client.modeles.InformationsRecherche;
7
import org.tela_botanica.del.client.modeles.InformationsRecherche;
8
import org.tela_botanica.del.client.modeles.Observation;
8
import org.tela_botanica.del.client.modeles.Observation;
9
import org.tela_botanica.del.client.modeles.Protocole;
9
import org.tela_botanica.del.client.modeles.Protocole;
10
import org.tela_botanica.del.client.modeles.Utilisateur;
10
import org.tela_botanica.del.client.modeles.Utilisateur;
11
 
11
 
12
import com.google.gwt.user.client.Window.Location;
12
import com.google.gwt.user.client.Window.Location;
13
 
13
 
14
public class CacheClient {
14
public class CacheClient {
15
 
15
 
16
	private List<Protocole> listeProtocoles;
16
	private List<Protocole> listeProtocoles;
17
	
17
	
18
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
18
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
19
	private Observation observationCourante;
19
	private Observation observationCourante;
20
	private Image imageCourante;
20
	private Image imageCourante;
21
	private String taxonPourRechercheEflore;
21
	private String taxonPourRechercheEflore;
22
	private Protocole protocoleCourant;
22
	private Protocole protocoleCourant;
23
	private String referentielCourant;
23
	private String referentielCourant;
24
	private int numPageRechercheImage = 0;
24
	private int numPageRechercheImage = 0;
25
	private int nbTotalImagesRecherchees = 0;
25
	private int nbTotalImagesRecherchees = 0;
26
	
26
	
27
	private boolean referentielNonModifiable = false;
27
	private boolean referentielNonModifiable = false;
28
 
28
 
29
	private int pasPagination = 12;
29
	private int pasPagination = 12;
30
	private int pageCouranteRechercheImage = 1;
30
	private int pageCouranteRechercheImage = 1;
31
	private int pageCouranteRechercheObservations = 1;
31
	private int pageCouranteRechercheObservations = 1;
32
	private InformationsRecherche informationsRechercheImage;
32
	private InformationsRecherche informationsRechercheImage;
33
	private InformationsRecherche informationsRechercheObservation;
33
	private InformationsRecherche informationsRechercheObservation;
34
	private Utilisateur utilisateur;
34
	private Utilisateur utilisateur;
35
	private String pageCourante = home;
35
	private String pageCourante = home;
36
	private String statut;
36
	private String statut;
37
	
37
	
38
	public void supprimerFiltreStatut() {
38
	public void supprimerFiltreStatut() {
39
		this.statut = null;
39
		this.statut = null;
40
	}
40
	}
41
	
41
	
42
	public void setFiltreStatut(String statut) {
42
	public void setFiltreStatut(String statut) {
43
		this.statut = statut;
43
		this.statut = statut;
44
	}
44
	}
45
	
45
	
46
	public String getFiltreStatut() {
46
	public String getFiltreStatut() {
47
		return this.statut;
47
		return this.statut;
48
	}
48
	}
49
	
49
	
50
	public String getPageCourante() {
50
	public String getPageCourante() {
51
		return pageCourante;
51
		return pageCourante;
52
	}
52
	}
53
 
53
 
54
	public void setPageCourante(String pageCourante) {
54
	public void setPageCourante(String pageCourante) {
55
		this.pageCourante = pageCourante;
55
		this.pageCourante = pageCourante;
56
	}
56
	}
57
 
57
 
58
	private static CacheClient instance;
58
	private static CacheClient instance;
59
 
59
 
60
	private CacheClient() {
60
	private CacheClient() {
61
		instance = this;
61
		instance = this;
62
	}
62
	}
63
 
63
 
64
	public void initialiserAvecParametres() {
64
	public void initialiserAvecParametres() {
65
		String rechercheLibre = Location.getParameter("masque");
65
		String rechercheLibre = Location.getParameter("masque");
66
		String famille = Location.getParameter("masque.famille");
66
		String famille = Location.getParameter("masque.famille");
67
		String taxon = Location.getParameter("masque.ns");
67
		String taxon = Location.getParameter("masque.ns");
68
		String genre = Location.getParameter("masque.genre");
68
		String genre = Location.getParameter("masque.genre");
69
		String commune = Location.getParameter("masque.commune");
69
		String commune = Location.getParameter("masque.commune");
70
		String dept = Location.getParameter("masque.departement");
70
		String dept = Location.getParameter("masque.departement");
71
		String auteur = Location.getParameter("masque.auteur");
71
		String auteur = Location.getParameter("masque.auteur");
72
		String date = Location.getParameter("masque.date");
72
		String date = Location.getParameter("masque.date");
73
		String tag = Location.getParameter("masque.tag");
73
		String tag = Location.getParameter("masque.tag");
-
 
74
		String tagCel = Location.getParameter("masque.tag_cel");
-
 
75
		String tagDel = Location.getParameter("masque.tag_pictoflora");
74
		String referentiel = Location.getParameter("masque.referentiel");
76
		String referentiel = Location.getParameter("masque.referentiel");
75
		
77
		
76
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
78
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
77
		rechercheParArguments.setRechercheLibre(rechercheLibre);
79
		rechercheParArguments.setRechercheLibre(rechercheLibre);
78
		rechercheParArguments.setFamille(famille);
80
		rechercheParArguments.setFamille(famille);
79
		rechercheParArguments.setTaxon(taxon);
81
		rechercheParArguments.setTaxon(taxon);
80
		rechercheParArguments.setGenre(genre);
82
		rechercheParArguments.setGenre(genre);
81
		rechercheParArguments.setCommune(commune);
83
		rechercheParArguments.setCommune(commune);
82
		rechercheParArguments.setDepartement(dept);
84
		rechercheParArguments.setDepartement(dept);
83
		rechercheParArguments.setAuteur(auteur);
85
		rechercheParArguments.setAuteur(auteur);
84
		rechercheParArguments.setDate(date);
86
		rechercheParArguments.setDate(date);
85
		rechercheParArguments.setTag(tag);
87
		rechercheParArguments.setTag(tag);
-
 
88
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
-
 
89
			rechercheParArguments.setMotClefCel(tagCel);
-
 
90
			rechercheParArguments.setMotClefDel(tagDel);
-
 
91
		}
86
		rechercheParArguments.setMotClef(tag);
92
		rechercheParArguments.setMotClef(tag);
87
		
93
		
88
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
94
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
89
		if(referentiel != null && !referentiel.equals("")) {
95
		if(referentiel != null && !referentiel.equals("")) {
90
			setReferentielCourant(referentiel);
96
			setReferentielCourant(referentiel);
91
			rechercheParArguments.setReferentiel(referentiel);
97
			rechercheParArguments.setReferentiel(referentiel);
92
			referentielNonModifiable = true;
98
			referentielNonModifiable = true;
93
		}
99
		}
94
		
100
		
95
		informationsRechercheImage = rechercheParArguments;
101
		informationsRechercheImage = rechercheParArguments;
96
		informationsRechercheObservation = rechercheParArguments;
102
		informationsRechercheObservation = rechercheParArguments;
97
	}
103
	}
98
	
104
	
99
	public Utilisateur getUtilisateur() {
105
	public Utilisateur getUtilisateur() {
100
		if (this.utilisateur == null) {
106
		if (this.utilisateur == null) {
101
			this.utilisateur = new Utilisateur(null);
107
			this.utilisateur = new Utilisateur(null);
102
		}
108
		}
103
		return this.utilisateur;
109
		return this.utilisateur;
104
	}
110
	}
105
	
111
	
106
	public void setUtilisateur(Utilisateur utilisateur) {
112
	public void setUtilisateur(Utilisateur utilisateur) {
107
		this.utilisateur = utilisateur; 
113
		this.utilisateur = utilisateur; 
108
	}
114
	}
109
	
115
	
110
	public void setHome(String home) {
116
	public void setHome(String home) {
111
		this.home = home;
117
		this.home = home;
112
		setPageCourante(home);
118
		setPageCourante(home);
113
	}
119
	}
114
	
120
	
115
	public String getHome() {
121
	public String getHome() {
116
		return home;
122
		return home;
117
	}
123
	}
118
	
124
	
119
	public Observation getObservationCourante() {
125
	public Observation getObservationCourante() {
120
		return observationCourante;
126
		return observationCourante;
121
	}
127
	}
122
 
128
 
123
	public void setObservationCourante(Observation observationCourante) {
129
	public void setObservationCourante(Observation observationCourante) {
124
		this.observationCourante = observationCourante;
130
		this.observationCourante = observationCourante;
125
	}
131
	}
126
 
132
 
127
	public static CacheClient getInstance() {
133
	public static CacheClient getInstance() {
128
		if (instance == null) {
134
		if (instance == null) {
129
			instance = new CacheClient();
135
			instance = new CacheClient();
130
		}
136
		}
131
		return instance;
137
		return instance;
132
	}
138
	}
133
 
139
 
134
	public String getTaxonPourRechercheEflore() {
140
	public String getTaxonPourRechercheEflore() {
135
		return taxonPourRechercheEflore;
141
		return taxonPourRechercheEflore;
136
	}
142
	}
137
 
143
 
138
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
144
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
139
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
145
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
140
	}
146
	}
141
 
147
 
142
	public int getNumPageRechercheImage() {
148
	public int getNumPageRechercheImage() {
143
		return numPageRechercheImage;
149
		return numPageRechercheImage;
144
	}
150
	}
145
 
151
 
146
	// Pour la recherche :
152
	// Pour la recherche :
147
	public int getPasPagination() {
153
	public int getPasPagination() {
148
		return pasPagination;
154
		return pasPagination;
149
	}
155
	}
150
 
156
 
151
	public void setPasPagination(int pasPagination) {
157
	public void setPasPagination(int pasPagination) {
152
		this.pasPagination = pasPagination;
158
		this.pasPagination = pasPagination;
153
	}
159
	}
154
 
160
 
155
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
161
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
156
		this.pageCouranteRechercheImage = pageCouranteRecherche;
162
		this.pageCouranteRechercheImage = pageCouranteRecherche;
157
	}
163
	}
158
 
164
 
159
	public int getPageCouranteRechercheImage() {
165
	public int getPageCouranteRechercheImage() {
160
		return this.pageCouranteRechercheImage;
166
		return this.pageCouranteRechercheImage;
161
	}
167
	}
162
 
168
 
163
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
169
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
164
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
170
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
165
	}
171
	}
166
 
172
 
167
	public int getNbTotalImagesRecherchees() {
173
	public int getNbTotalImagesRecherchees() {
168
		return this.nbTotalImagesRecherchees;
174
		return this.nbTotalImagesRecherchees;
169
	}
175
	}
170
 
176
 
171
	public Image getImageCourante() {
177
	public Image getImageCourante() {
172
		return imageCourante;
178
		return imageCourante;
173
	}
179
	}
174
 
180
 
175
	public void setImageCourante(Image imageCourante) {
181
	public void setImageCourante(Image imageCourante) {
176
		this.imageCourante = imageCourante;
182
		this.imageCourante = imageCourante;
177
	}
183
	}
178
	
184
	
179
	public void setListeProtocoles(List<Protocole> listeProtocole) {
185
	public void setListeProtocoles(List<Protocole> listeProtocole) {
180
		this.listeProtocoles = listeProtocole;
186
		this.listeProtocoles = listeProtocole;
181
	}
187
	}
182
	
188
	
183
	public List<Protocole> getListeProtocoles() {
189
	public List<Protocole> getListeProtocoles() {
184
		return this.listeProtocoles;
190
		return this.listeProtocoles;
185
	}
191
	}
186
 
192
 
187
	public Protocole getProtocoleCourant() {
193
	public Protocole getProtocoleCourant() {
188
		return protocoleCourant;
194
		return protocoleCourant;
189
	}
195
	}
190
 
196
 
191
	public void setProtocoleCourant(Protocole protocoleCourant) {
197
	public void setProtocoleCourant(Protocole protocoleCourant) {
192
		this.protocoleCourant = protocoleCourant;
198
		this.protocoleCourant = protocoleCourant;
193
	}
199
	}
194
 
200
 
195
	public InformationsRecherche getInformationsRechercheImage() {
201
	public InformationsRecherche getInformationsRechercheImage() {
196
		if(informationsRechercheImage == null) {
202
		if(informationsRechercheImage == null) {
197
			informationsRechercheImage = new InformationsRecherche();
203
			informationsRechercheImage = new InformationsRecherche();
198
		}
204
		}
199
		return informationsRechercheImage;
205
		return informationsRechercheImage;
200
	}
206
	}
201
 
207
 
202
	public InformationsRecherche getInformationsRechercheObservation() {
208
	public InformationsRecherche getInformationsRechercheObservation() {
203
		if(informationsRechercheObservation == null) {
209
		if(informationsRechercheObservation == null) {
204
			informationsRechercheObservation = new InformationsRecherche();
210
			informationsRechercheObservation = new InformationsRecherche();
205
		}
211
		}
206
		return informationsRechercheObservation;
212
		return informationsRechercheObservation;
207
	}
213
	}
208
 
214
 
209
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
215
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
210
		this.informationsRechercheImage = informationsRechercheImage;
216
		this.informationsRechercheImage = informationsRechercheImage;
211
	}
217
	}
212
 
218
 
213
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
219
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
214
		this.informationsRechercheObservation = informationsRechercheObservation;
220
		this.informationsRechercheObservation = informationsRechercheObservation;
215
	}
221
	}
216
 
222
 
217
	public int getPageCouranteRechercheObservations() {
223
	public int getPageCouranteRechercheObservations() {
218
		return pageCouranteRechercheObservations;
224
		return pageCouranteRechercheObservations;
219
	}
225
	}
220
 
226
 
221
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
227
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
222
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
228
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
223
	}
229
	}
224
	
230
	
225
	public void setReferentielCourant(String referentielCourant) {
231
	public void setReferentielCourant(String referentielCourant) {
226
		this.referentielCourant = referentielCourant;
232
		this.referentielCourant = referentielCourant;
227
	}
233
	}
228
	
234
	
229
	public String getReferentielCourant() {
235
	public String getReferentielCourant() {
230
		return referentielCourant;
236
		return referentielCourant;
231
	}
237
	}
232
	
238
	
233
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
239
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
234
		this.referentielNonModifiable = referentielNonModifiable;
240
		this.referentielNonModifiable = referentielNonModifiable;
235
	}
241
	}
236
	
242
	
237
	public boolean getReferentielNonModifiable() {
243
	public boolean getReferentielNonModifiable() {
238
		return referentielNonModifiable;
244
		return referentielNonModifiable;
239
	}
245
	}
240
}
246
}