Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1489 → Rev 1547

/branches/v1.6-croc/src/org/tela_botanica/client/modeles/objets/Configuration.java
1,6 → 1,12
package org.tela_botanica.client.modeles.objets;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.user.client.Window;
 
/**
* Classe chargeant certains paramètres de configuration à partir d'un fichier
49,6 → 55,8
private static String imageRedirectUrl;
private static String tailleMaxUpload;
private static List<InfosReferentielNom> referentielsDispos;
 
/**
* Constructeur sans argument
82,12 → 90,6
lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
"lienEfloreBaseUrl");
refTax = Dictionary.getDictionary("configuration").get(
"refTax");
refTaxVersion = Dictionary.getDictionary("configuration").get(
"refTaxVersion");
formatOriginal = Dictionary.getDictionary("configuration").get(
"formatOriginal");
109,8 → 111,19
tailleMaxUpload = Dictionary.getDictionary("configuration").get(
"tailleMaxUpload");
//licence = Dictionary.getDictionary("configuration").get("licence");
referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
"referentielsDispos"));
}
private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
String[] tabReferentiels = chaineListeReferentiels.split(";");
List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
for (int i = 0; i < tabReferentiels.length; i++) {
InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
referentiels.add(infoRef);
}
return referentiels;
}
 
/**
* Accesseur pour l'url de base du serveur jrest
179,14 → 192,6
return lienEfloreBaseUrl;
}
public static String getRefTax() {
return refTax;
}
public static String getRefTaxVersion() {
return refTaxVersion;
}
public static String getLicence() {
return licence;
}
218,4 → 223,8
public static String getTailleMaxUpload() {
return tailleMaxUpload;
}
public static List<InfosReferentielNom> getReferentielsDispos() {
return referentielsDispos;
}
}
/branches/v1.6-croc/src/org/tela_botanica/client/modeles/objets/InfosReferentielNom.java
New file
0,0 → 1,64
package org.tela_botanica.client.modeles.objets;
 
import com.google.gwt.user.client.Window;
 
public class InfosReferentielNom {
private String code = null;
private String version = null;
private String versionCourte = null;
private String intitule = null;
 
public InfosReferentielNom(String infosReferentiel) {
String[] codeCompletIntitule = infosReferentiel.split(",");
intitule = codeCompletIntitule[1];
String[] codeVersion = codeCompletIntitule[0].split(":");
code = codeVersion[0];
version = codeVersion[1];
versionCourte = formaterVersionCourte(version);
}
public InfosReferentielNom(String code, String version, String intitule) {
super();
this.code = code;
this.version = version;
this.intitule = intitule;
this.versionCourte = formaterVersionCourte(version);
}
private String formaterVersionCourte(String version) {
return version.replaceAll("v","");
}
public String getCodeVersionComplet() {
return code+":"+version;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getIntitule() {
return intitule;
}
public void setIntitule(String intitule) {
this.intitule = intitule;
}
 
public String getVersionCourte() {
return versionCourte;
}
 
public void setVersionCourte(String versionCourte) {
this.versionCourte = versionCourte;
}
}
/branches/v1.6-croc/src/org/tela_botanica/client/modeles/objets/ReferentielNom.java
1,15 → 1,11
package org.tela_botanica.client.modeles.objets;
 
 
 
 
 
/**
*
* Classe representant un element du referentiel de nom
*
*/
 
public class ReferentielNom {
 
 
22,7 → 18,6
}
 
/**
* @param nom
* @param numeroNom
29,14 → 24,10
* @param statut
*
*/
public ReferentielNom(String nom, String numeroNom, String statut) {
this.nom = nom;
this.numeroNom = numeroNom;
this.statut = statut;
 
}
 
 
44,7 → 35,6
return nom;
}
 
 
public String getNumeroNom() {
return numeroNom;
}
/branches/v1.6-croc/src/org/tela_botanica/client/modeles/objets/Ontologies.java
1,6 → 1,8
package org.tela_botanica.client.modeles.objets;
 
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
 
import com.gwtext.client.data.SimpleStore;
import com.gwtext.client.data.Store;
7,7 → 9,10
 
public class Ontologies {
//TODO: extraire toutes ces valeurs dans des fichiers de configuration
// ou bien via l'appel d'un web service spécialisé.
private static HashMap<String, String> valeursCertitude = null;
private static List<InfosReferentielNom> listeReferentielsNoms = null;
 
public static Store getValeursCertitude() {
Object[][] valeurs = {{"Certaine","certain"},
20,15 → 25,30
}
public static Store getValeursAbondance() {
Object[][] valeurs = {{"i : un seul individu","i"},
{"r : rare (quelques pieds)","r"},
{"+ : recouvrement R < 1%","+"},
{"1 : 1% < R < 5%","1"},
{"2 : 5% < R < 25%","2"},
{"3 : 25% < R < 50%","3"},
{"4 : 50% < R < 75%","4"},
{"5 : recouvrement R > 75%","5"}
};
Object[][] valeurs = {
{"5 : recouvrement R > 75%","5"},
{"4 : 50% < R < 75%","4"},
{"3 : 25% < R < 50%","3"},
{"2 : 5% < R < 25%","2"},
{"1 : 1% < R < 5%","1"},
{"+ : recouvrement R < 1%","+"},
{"r : rare (quelques pieds)","r"},
{"i : un seul individu","i"},
{"1-5 individus","1-5"},
{"5-10 individus","5-10"},
{"10-50 individus","10-50"},
{"50-100 individus","50-100"},
{"100-500 individus","100-500"},
{">500 individus",">500"},
{"E : exceptionnel","E"},
{"RR : très rare","RR"},
{"R : rare","R"},
{"AR : assez rare","E"},
{"PC : peu commun","PC"},
{"AC : assez commun","AC"},
{"C : commun","C"},
{"CC : très commun","C"}
};
SimpleStore storeAbondance = new SimpleStore(new String[] {"label","valeur"},valeurs);
storeAbondance.load();
return storeAbondance;
46,4 → 66,61
return valeur == null ? cle : valeur;
}
public static Store getValeursReferentiel() {
List<InfosReferentielNom> listeReferentiels = Configuration.getReferentielsDispos();
Object[][] valeurs = new Object[listeReferentiels.size()][2];
int i = 0;
for (Iterator<InfosReferentielNom> iterator = listeReferentiels.iterator(); iterator
.hasNext();) {
InfosReferentielNom infosReferentielNom = iterator.next();
String[] valeur = {infosReferentielNom.getIntitule(), infosReferentielNom.getCode()};
valeurs[i] = valeur;
i++;
}
SimpleStore storeReferentiels = new SimpleStore(new String[] {"label","valeur"},valeurs);
storeReferentiels.load();
return storeReferentiels;
}
 
public static InfosReferentielNom getInfosReferentielNomParCode(String code) {
InfosReferentielNom infos = null;
List<InfosReferentielNom> listeReferentiels = Configuration.getReferentielsDispos();
for (Iterator<InfosReferentielNom> iterator = listeReferentiels.iterator(); iterator
.hasNext();) {
InfosReferentielNom infosReferentielNom = iterator.next();
if(infosReferentielNom.getCode().equals(code)) {
infos = infosReferentielNom;
break;
}
}
return infos;
}
public static Store getValeursPhenologie() {
Object[][] valeurs = {
{"00-09: germination, développement des bourgeons", "00-09"},
{"10-19: développement des feuilles", "10-19"},
{"11: par ex, environ 10% des feuilles épanouies", "11"},
{"15: par ex, environ 50% des feuilles épanouies", "15"},
{"20-29: formation de pousses latérales, tallage", "20-29"},
{"30-39: développement des tiges, croissance des rosettes", "30-39"},
{"40-49: développement des organes de propagation végétative", "40-49"},
{"50-59: apparition de l'inflorescence, épiaison", "50-59"},
{"60-69: floraison", "60-69"},
{"61 : par ex, environ 10% des fleurs épanouies", "61"},
{"65 : par ex, environ 50% des fleurs épanouies", "65"},
{"70-79: fructification", "70-79"},
{"80-89: maturité des fruits et des graines", "80-89"},
{"85: par ex, 50% des fruits matures", "85"},
{"90-99: sénescence et dormance", "90-99"},
{"91: par ex, environ 10% des feuilles jaunes", "91"},
{"95: par ex, environ 50% des feuilles jaunes", "95"}
};
SimpleStore storeAbondance = new SimpleStore(new String[] {"label","valeur"},valeurs);
storeAbondance.load();
return storeAbondance;
}
}
/branches/v1.6-croc/src/org/tela_botanica/client/modeles/objets/Observation.java
1,5 → 1,8
package org.tela_botanica.client.modeles.objets;
 
import java.util.List;
import java.util.Map;
 
import org.tela_botanica.client.util.Util;
 
import com.google.gwt.json.client.JSONObject;
27,8 → 30,13
private String latitude=null;
private String longitude=null;
private String referentielGeo=null;
private String referentielTaxo=null;
private String abondance=null;
private String certitude=null;
private String phenologie=null;
private String altitude=null;
private Map<String, String> champsEtendus=null;
 
public Observation() {
}
106,6 → 114,8
this.motsCles = Util.getValeurJsonOuVide(observation,"mots_cles");
this.abondance = Util.getValeurJsonOuVide(observation,"abondance");
this.certitude = Util.getValeurJsonOuVide(observation,"certitude");
this.phenologie = Util.getValeurJsonOuVide(observation,"phenologie");
this.setReferentielTaxo(Util.getValeurJsonOuVide(observation,"nom_referentiel"));
}
/**
287,4 → 297,60
public void setCertitude(String certitude) {
this.certitude = certitude;
}
 
public String getReferentielTaxo() {
return referentielTaxo;
}
 
public String getCodeCourtReferentielTaxo() {
String codeRef = "";
if(!getReferentielTaxo().equals("") && getReferentielTaxo().length() >= 5) {
codeRef = referentielTaxo.substring(0, 5);
}
return codeRef;
}
 
public void setReferentielTaxo(String referentielTaxo) {
this.referentielTaxo = referentielTaxo;
}
public String getPhenologie() {
return phenologie;
}
public void setPhenologie(String phenologie) {
this.phenologie = phenologie;
}
 
public String getAltitude() {
return altitude;
}
 
 
public void setAltitude(String altitude) {
this.altitude = altitude;
}
 
 
public void setValeurChampEtendu(String cle, String valeur) {
champsEtendus.put(cle, valeur);
}
 
public String getValeurChampEtendu(String cle) {
String valeur = "";
if(champsEtendus.containsKey(cle)) {
valeur = champsEtendus.get(cle);
}
return valeur;
}
public Map<String, String> getChampsEtendus() {
return champsEtendus;
}
 
 
public void setChampsEtendus(Map<String, String> champsEtendus) {
this.champsEtendus = champsEtendus;
}
}