Rev 1986 | Rev 2139 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.modeles;import org.tela_botanica.del.client.config.Config;import com.google.gwt.http.client.URL;import com.google.gwt.user.client.Window;public class InformationsRecherche {private String rechercheLibre;private String departement;private String referentiel;private String taxon;private String genre;// gardé pour ancienne comptabilitéprivate String motClef;// mots clés publics de delprivate String motClefDel;// mots clés privés du celprivate String motClefCel;private String date;private String pays;private String commune;private String famille;private String tag;private String auteur;private String idProtocoleSelectionne = null;private ModeTri triParMoyenneArithmetique = ModeTri.PAS_DE_TRI;private ModeTri triParDatePublication = ModeTri.PAS_DE_TRI;private ModeTri triParDateObservation = ModeTri.PAS_DE_TRI;private ModeTri triParNbCommentaires = ModeTri.PAS_DE_TRI;private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;private ModeTri triParNbPoints = ModeTri.PAS_DE_TRI;public String getRechercheLibre() {return rechercheLibre;}public void setRechercheLibre(String rechercheLibre) {if (rechercheLibre != null) {this.rechercheLibre = rechercheLibre;}}public String getDepartement() {return departement;}public void setDepartement(String departement) {if (departement != null) {this.departement = departement;}}public String getReferentiel() {return referentiel;}public void setReferentiel(String referentiel) {this.referentiel = referentiel;}public String getTaxon() {return taxon;}public void setTaxon(String taxon) {if (taxon != null) {this.taxon = taxon;}}public String getGenre() {return genre;}public void setGenre(String genre) {if (genre != null) {this.genre = genre;}}public String getMotClef() {return motClef;}public void setMotClef(String motClef) {if (motClef != null) {this.motClef = motClef;}}public String getDate() {return date;}public void setDate(String date) {if (date != null) {this.date = date;}}public String setPays(String pays) {return this.pays = pays;}public String getPays() {return pays;}public String getCommune() {return commune;}public void setCommune(String commune) {if (commune != null) {String[] tableauCommuneDpt = commune.split(" ");if (tableauCommuneDpt.length == 2) {String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");setDepartement(dpt);this.commune = tableauCommuneDpt[0];} else {this.commune = commune;}}}public String getFamille() {return famille;}public void setFamille(String famille) {if (famille != null) {this.famille = famille;}}public String getTag() {return tag;}public void setTag(String tag) {if (tag != null) {this.tag = tag;}}public String getAuteur() {return auteur;}public void setAuteur(String auteur) {if (auteur != null) {this.auteur = auteur;}}public ModeTri getTriParMoyenneArithmetique() {return triParMoyenneArithmetique;}public void setTriParMoyenneArithmetique(ModeTri triParMoyenneArithmetique) {this.triParMoyenneArithmetique = triParMoyenneArithmetique;}public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {this.idProtocoleSelectionne = idProtocoleSelectionne;}public String getIdProtocoleSelectionne() {return idProtocoleSelectionne;}public ModeTri getTriParDatePublication() {return triParDatePublication;}public void setTriParDatePublication(ModeTri triParDatePublication) {this.triParDatePublication = triParDatePublication;}public ModeTri getTriParDateObservation() {return triParDateObservation;}public void setTriParDateObservation(ModeTri triParDateObservation) {this.triParDateObservation = triParDateObservation;}public void setTriParNbTags(ModeTri triParTag) {this.triParNbTag = triParTag;}public ModeTri getTriParNbPoints() {return this.triParNbPoints;}public void setTriParNbPoints(ModeTri triParPoints) {this.triParNbPoints = triParPoints;}public ModeTri getTriParNbTags() {return this.triParNbTag;}public void setTriParNbCommentaires(ModeTri triParNbCommentaires) {this.triParNbCommentaires = triParNbCommentaires;}public ModeTri getTriParNbCommentaires() {return triParNbCommentaires;}public String versChaineRequete() {String chaine = "";chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";chaine += estNonNull(motClefCel) ? "&masque.tag_cel=" + URL.encodeQueryString(motClefCel) : "";chaine += estNonNull(motClefDel) ? "&masque.tag_pictoflora=" + URL.encodeQueryString(motClefDel) : "";chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";chaine += estNonNull(pays) ? "&masque.pays=" + URL.encodeQueryString(pays) : "";String urlCourante = Window.Location.getHref();Config config = new Config();String urlAppliImg = config.getUrl("pictoflora");if (urlCourante.contains(urlAppliImg)) {chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&tri=moyenne-arithmetique" : "";chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&ordre=" + triParMoyenneArithmetique : "";chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&tri=points" : "";chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbPoints : "";chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";} else {chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&tri=nb_commentaires" : "";chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbCommentaires : "";}chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDateObservation : "";chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&tri=date_transmission" : "";chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDatePublication : "";return chaine;}private boolean estNonNull(String critere) {return critere != null && !critere.trim().isEmpty();}public String getMotClefDel() {return motClefDel;}public void setMotClefDel(String motClefDel) {this.motClefDel = motClefDel;}public String getMotClefCel() {return motClefCel;}public void setMotClefCel(String motClefCel) {this.motClefCel = motClefCel;}}