Subversion Repositories eFlore/Applications.del

Rev

Rev 1367 | Rev 1467 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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