Subversion Repositories eFlore/Applications.cel

Rev

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