Subversion Repositories eFlore/Applications.cel

Rev

Rev 2652 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1489 aurelien 1
package org.tela_botanica.client.modeles.objets;
2
 
3
import java.util.HashMap;
1542 aurelien 4
import java.util.Iterator;
5
import java.util.List;
1489 aurelien 6
 
2643 aurelien 7
import org.tela_botanica.client.i18n.Msg;
8
 
1489 aurelien 9
import com.gwtext.client.data.SimpleStore;
10
import com.gwtext.client.data.Store;
11
 
12
public class Ontologies {
13
 
1542 aurelien 14
	//TODO: extraire toutes ces valeurs dans des fichiers de configuration
15
	// ou bien via l'appel d'un web service spécialisé.
1489 aurelien 16
	private static HashMap<String, String> valeursCertitude = null;
1542 aurelien 17
	private static List<InfosReferentielNom> listeReferentielsNoms = null;
1489 aurelien 18
 
19
	public static Store getValeursCertitude() {
2643 aurelien 20
		Object[][] valeurs = {{Msg.get("certain"),"certain"},
21
				{Msg.get("douteux"),"douteux"},
22
				{Msg.get("a-determiner"),"aDeterminer"}
1489 aurelien 23
			};
24
		SimpleStore storeCertitude = new SimpleStore(new String[] {"label","valeur"},valeurs);
25
		storeCertitude.load();
26
		return storeCertitude;
27
	}
28
 
29
	public static Store getValeursAbondance() {
1542 aurelien 30
		Object[][] valeurs = {
2643 aurelien 31
			{Msg.get("abondance-5"),"5"},
32
			{Msg.get("abondance-4"),"4"},
33
			{Msg.get("abondance-3"),"3"},
34
			{Msg.get("abondance-2"),"2"},
35
			{Msg.get("abondance-1"),"1"},
36
			{Msg.get("abondance-+"),"+"},
37
			{Msg.get("abondance-r"),"r"},
38
			{Msg.get("abondance-i"),"i"},
39
			{Msg.get("abondance-1-5"),"1-5"},
40
			{Msg.get("abondance-5-10"),"5-10"},
41
			{Msg.get("abondance-10-50"),"10-50"},
42
			{Msg.get("abondance-50-100"),"50-100"},
43
			{Msg.get("abondance-100-500"),"100-500"},
44
			{Msg.get("abondance->500"),">500"},
45
			{Msg.get("abondance-E"),"E"},
46
			{Msg.get("abondance-RR"),"RR"},
47
			{Msg.get("abondance-R"),"R"},
48
			{Msg.get("abondance-AR"),"AR"},
49
			{Msg.get("abondance-PC"),"PC"},
50
			{Msg.get("abondance-AC"),"AC"},
51
			{Msg.get("abondance-C"),"C"},
52
			{Msg.get("abondance-CC"),"CC"}
1542 aurelien 53
		};
1489 aurelien 54
		SimpleStore storeAbondance = new SimpleStore(new String[] {"label","valeur"},valeurs);
55
		storeAbondance.load();
56
		return storeAbondance;
57
	}
58
 
59
	public static String getCorrespondanceCertitude(String cle) {
60
		if(valeursCertitude == null) {
61
			valeursCertitude = new HashMap<String, String>();
2643 aurelien 62
			valeursCertitude.put("certain", Msg.get("certain"));
63
			valeursCertitude.put("douteux", Msg.get("douteux"));
64
			valeursCertitude.put("aDeterminer", Msg.get("a-determiner"));
1489 aurelien 65
		}
66
 
67
		String valeur = valeursCertitude.get(cle);
68
 
69
		return valeur == null ? cle : valeur;
70
	}
1542 aurelien 71
 
72
	public static Store getValeursReferentiel() {
73
		List<InfosReferentielNom> listeReferentiels = Configuration.getReferentielsDispos();
74
		Object[][] valeurs = new Object[listeReferentiels.size()][2];
75
		int i = 0;
76
		for (Iterator<InfosReferentielNom> iterator = listeReferentiels.iterator(); iterator
77
				.hasNext();) {
78
			InfosReferentielNom infosReferentielNom = iterator.next();
79
 
2652 aurelien 80
			String referentielNom = Msg.get("referentiel-"+infosReferentielNom.getCode());
81
			String[] valeur = {referentielNom, infosReferentielNom.getCode()};
1542 aurelien 82
			valeurs[i] = valeur;
83
			i++;
84
		}
85
		SimpleStore storeReferentiels = new SimpleStore(new String[] {"label","valeur"},valeurs);
86
		storeReferentiels.load();
87
		return storeReferentiels;
88
	}
89
 
90
	public static InfosReferentielNom getInfosReferentielNomParCode(String code) {
91
		InfosReferentielNom infos = null;
92
		List<InfosReferentielNom> listeReferentiels = Configuration.getReferentielsDispos();
93
		for (Iterator<InfosReferentielNom> iterator = listeReferentiels.iterator(); iterator
94
				.hasNext();) {
95
			InfosReferentielNom infosReferentielNom = iterator.next();
96
			if(infosReferentielNom.getCode().equals(code)) {
97
				infos = infosReferentielNom;
98
				break;
99
			}
100
		}
101
 
102
		return infos;
103
	}
104
 
105
	public static Store getValeursPhenologie() {
106
		Object[][] valeurs = {
2652 aurelien 107
			{Msg.get("phenologie-00-09"), "00-09"},
108
			{Msg.get("phenologie-10-19"), "10-19"},
109
			{Msg.get("phenologie-11"), "11"},
110
			{Msg.get("phenologie-15"), "15"},
111
			{Msg.get("phenologie-20-29"), "20-29"},
112
			{Msg.get("phenologie-30-39"), "30-39"},
113
			{Msg.get("phenologie-40-49"), "40-49"},
114
			{Msg.get("phenologie-50-59"), "50-59"},
115
			{Msg.get("phenologie-60-69"), "60-69"},
116
			{Msg.get("phenologie-61"), "61"},
117
			{Msg.get("phenologie-65"), "65"},
118
			{Msg.get("phenologie-70-79"), "70-79"},
119
			{Msg.get("phenologie-80-89"), "80-89"},
120
			{Msg.get("phenologie-85"), "85"},
121
			{Msg.get("phenologie-90-99"), "90-99"},
122
			{Msg.get("phenologie-91"), "91"},
123
			{Msg.get("phenologie-95"), "95"}
1542 aurelien 124
		};
125
		SimpleStore storeAbondance = new SimpleStore(new String[] {"label","valeur"},valeurs);
126
		storeAbondance.load();
127
		return storeAbondance;
128
	}
2033 aurelien 129
 
130
	public static HashMap<String, String> getCorrespondanceGrilleObservationChampsTri() {
131
		HashMap<String, String> correspondances = new HashMap<String, String>();
132
		correspondances.put("etat_observation", "transmission");
133
		correspondances.put("referentiel_taxo_observation", "nom_referentiel");
134
		correspondances.put("nomSaisi_observation", "nom_sel");
135
		correspondances.put("certitude", "certitude");
136
		correspondances.put("nomRetenu_observation", "nom_ret");
137
		correspondances.put("famille_observation", "famille");
138
		correspondances.put("abondance", "abondance");
139
		correspondances.put("phenologie", "phenologie");
140
		correspondances.put("etat_observation", "transmission");
2040 aurelien 141
		correspondances.put("lieu_observation", "ce_zone_geo");
2033 aurelien 142
		correspondances.put("altitude_observation", "altitude");
143
		correspondances.put("date_observation", "date_observation");
144
		correspondances.put("ordre_observation", "ordre");
145
 
146
		return correspondances;
147
	}
1489 aurelien 148
}