Subversion Repositories eFlore/Applications.coel

Rev

Rev 875 | Rev 889 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 875 Rev 877
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
2
 
2
 
3
import java.util.LinkedHashMap;
3
import java.util.LinkedHashMap;
4
 
4
 
5
import com.google.gwt.i18n.client.Dictionary;
5
import com.google.gwt.i18n.client.Dictionary;
6
 
6
 
7
/**
7
/**
8
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
8
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
9
 * javascript (config.js)
9
 * javascript (config.js)
10
 * 
10
 * 
11
 * @author Aurélien PERONNET
11
 * @author Aurélien PERONNET
12
 * 
12
 * 
13
 */
13
 */
14
public class Configuration {
14
public class Configuration {
15
 
15
 
16
	/**
16
	/**
17
	 * L'url de base du serveur jrest
17
	 * L'url de base du serveur jrest
18
	 */
18
	 */
19
	private String serviceBaseUrl;
19
	private String serviceBaseUrl;
20
	
20
	
21
	/**
21
	/**
22
	 * L'url de base du Carnet en Ligne
22
	 * L'url de base du Carnet en Ligne
23
	 */
23
	 */
24
	private String celUrl;
24
	private String celUrl;
25
	
25
	
26
	/**
26
	/**
27
	 * Tableau associatif contenant les identifiants des listes 
27
	 * Tableau associatif contenant les identifiants des listes 
28
	 */
28
	 */
29
	private LinkedHashMap<String, Integer> listesId = new LinkedHashMap<String, Integer>();
29
	private LinkedHashMap<String, Integer> listesId = new LinkedHashMap<String, Integer>();
30
 
30
 
31
	/**
31
	/**
32
	 * Constructeur sans argument
32
	 * Constructeur sans argument
33
	 */
33
	 */
34
	public Configuration() {
34
	public Configuration() {
35
		// on utilise le dictionnaire d'internationalisation pour lire les variables du fichier javascript
35
		// on utilise le dictionnaire d'internationalisation pour lire les variables du fichier javascript
36
		Dictionary configuration = Dictionary.getDictionary("configuration");
36
		Dictionary configuration = Dictionary.getDictionary("configuration");
37
		serviceBaseUrl = configuration.get("serviceBaseUrl");
37
		serviceBaseUrl = configuration.get("serviceBaseUrl");
38
		celUrl = configuration.get("celUrl");
38
		celUrl = configuration.get("celUrl");
39
		listesId.put("stpr", Integer.valueOf(configuration.get("listeStpr")));
39
		listesId.put("stpr", Integer.valueOf(configuration.get("listeStpr")));
40
		listesId.put("stpu", Integer.valueOf(configuration.get("listeStpu")));
40
		listesId.put("stpu", Integer.valueOf(configuration.get("listeStpu")));
41
		listesId.put("statut", Integer.valueOf(configuration.get("listeStatut")));
41
		listesId.put("statut", Integer.valueOf(configuration.get("listeStatut")));
42
		listesId.put("fonction", Integer.valueOf(configuration.get("listeFonction")));
42
		listesId.put("fonction", Integer.valueOf(configuration.get("listeFonction")));
43
		listesId.put("botaAcronyme", Integer.valueOf(configuration.get("listeAcronymeBota")));
43
		listesId.put("botaAcronyme", Integer.valueOf(configuration.get("listeAcronymeBota")));
44
		listesId.put("localStockage", Integer.valueOf(configuration.get("listeStockageLocal")));
44
		listesId.put("localStockage", Integer.valueOf(configuration.get("listeStockageLocal")));
45
		listesId.put("meubleStockage", Integer.valueOf(configuration.get("listeStockageMeuble")));
45
		listesId.put("meubleStockage", Integer.valueOf(configuration.get("listeStockageMeuble")));
46
		listesId.put("parametreStockage", Integer.valueOf(configuration.get("listeStockageParametre")));
46
		listesId.put("parametreStockage", Integer.valueOf(configuration.get("listeStockageParametre")));
47
		listesId.put("autreCollection", Integer.valueOf(configuration.get("listeCollectionAutre")));
47
		listesId.put("autreCollection", Integer.valueOf(configuration.get("listeCollectionAutre")));
48
		listesId.put("opRestau", Integer.valueOf(configuration.get("listeRestaurationOperation")));
48
		listesId.put("opRestau", Integer.valueOf(configuration.get("listeRestaurationOperation")));
49
		listesId.put("onep", Integer.valueOf(configuration.get("listeONEP")));
49
		listesId.put("onep", Integer.valueOf(configuration.get("listeONEP")));
50
		listesId.put("autreMateriel", Integer.valueOf(configuration.get("listeMaterielAutre")));
50
		listesId.put("autreMateriel", Integer.valueOf(configuration.get("listeMaterielAutre")));
51
		listesId.put("poisonTraitement", Integer.valueOf(configuration.get("listeEmpoisonnement")));
51
		listesId.put("poisonTraitement", Integer.valueOf(configuration.get("listeEmpoisonnement")));
52
		listesId.put("insecteTraitement", Integer.valueOf(configuration.get("listeDesinsectisation")));
52
		listesId.put("insecteTraitement", Integer.valueOf(configuration.get("listeDesinsectisation")));
53
		listesId.put("actionValorisation", Integer.valueOf(configuration.get("listeValorisationAction")));
53
		listesId.put("actionValorisation", Integer.valueOf(configuration.get("listeValorisationAction")));
54
		listesId.put("continentEtFr", Integer.valueOf(configuration.get("listeContinentEtFr")));
54
		listesId.put("continentEtFr", Integer.valueOf(configuration.get("listeContinentEtFr")));
55
		listesId.put("typeRecherche", Integer.valueOf(configuration.get("listeRechercheType")));
55
		listesId.put("typeRecherche", Integer.valueOf(configuration.get("listeRechercheType")));
56
		listesId.put("pays", Integer.valueOf(configuration.get("listePays")));
56
		listesId.put("pays", Integer.valueOf(configuration.get("listePays")));
57
		listesId.put("typeCollectionNcd", Integer.valueOf(configuration.get("listeTypeCollectionNcd")));
57
		listesId.put("typeCollectionNcd", Integer.valueOf(configuration.get("listeTypeCollectionNcd")));
58
		listesId.put("typeCollectionBota", Integer.valueOf(configuration.get("listeTypeCollectionBota")));
58
		listesId.put("typeCollectionBota", Integer.valueOf(configuration.get("listeTypeCollectionBota")));
59
		listesId.put("typeDepot", Integer.valueOf(configuration.get("listeTypeDepot")));
59
		listesId.put("typeDepot", Integer.valueOf(configuration.get("listeTypeDepot")));
60
		listesId.put("typeUniteRangement", Integer.valueOf(configuration.get("listeTypeUniteRangement")));
60
		listesId.put("typeUniteRangement", Integer.valueOf(configuration.get("listeTypeUniteRangement")));
61
		listesId.put("etat", Integer.valueOf(configuration.get("listeEtat")));
61
		listesId.put("etat", Integer.valueOf(configuration.get("listeEtat")));
62
		listesId.put("typeUniteBase", Integer.valueOf(configuration.get("listeTypeUniteBase")));
62
		listesId.put("typeUniteBase", Integer.valueOf(configuration.get("listeTypeUniteBase")));
63
		listesId.put("typePapier", Integer.valueOf(configuration.get("listeTypePapier")));
63
		listesId.put("typePapier", Integer.valueOf(configuration.get("listeTypePapier")));
64
		listesId.put("methodeRangement", Integer.valueOf(configuration.get("listeMethodeRangement")));
64
		listesId.put("methodeRangement", Integer.valueOf(configuration.get("listeMethodeRangement")));
65
		listesId.put("methodeFixation", Integer.valueOf(configuration.get("listeMethodeFixation")));
65
		listesId.put("methodeFixation", Integer.valueOf(configuration.get("listeMethodeFixation")));
66
		listesId.put("methodeFixationSurSpecimen", Integer.valueOf(configuration.get("listeMethodeFixationSurSpecimen")));
66
		listesId.put("methodeFixationSurSpecimen", Integer.valueOf(configuration.get("listeMethodeFixationSurSpecimen")));
67
		listesId.put("typeEcriture", Integer.valueOf(configuration.get("listeTypeEcriture")));
67
		listesId.put("typeEcriture", Integer.valueOf(configuration.get("listeTypeEcriture")));
68
		listesId.put("onpi", Integer.valueOf(configuration.get("listeONPI")));
68
		listesId.put("onpi", Integer.valueOf(configuration.get("listeONPI")));
69
		listesId.put("specimenDegradation", Integer.valueOf(configuration.get("listeSpecimenDegradation")));
69
		listesId.put("specimenDegradation", Integer.valueOf(configuration.get("listeSpecimenDegradation")));
70
		listesId.put("supportDegradation", Integer.valueOf(configuration.get("listeSupportDegradation")));
70
		listesId.put("supportDegradation", Integer.valueOf(configuration.get("listeSupportDegradation")));
71
		listesId.put("niveauDetermination", Integer.valueOf(configuration.get("listeNiveauDetermination")));
71
		listesId.put("niveauDetermination", Integer.valueOf(configuration.get("listeNiveauDetermination")));
72
		listesId.put("natureVegetale", Integer.valueOf(configuration.get("listeNatureVegetale")));
72
		listesId.put("natureVegetale", Integer.valueOf(configuration.get("listeNatureVegetale")));
73
		listesId.put("siecleNaturaliste", Integer.valueOf(configuration.get("listeSiecleNaturaliste")));
73
		listesId.put("siecleNaturaliste", Integer.valueOf(configuration.get("listeSiecleNaturaliste")));
74
		listesId.put("dateDebut", Integer.valueOf(configuration.get("listeDateDebut")));
74
		listesId.put("dateDebut", Integer.valueOf(configuration.get("listeDateDebut")));
75
		listesId.put("dateFin", Integer.valueOf(configuration.get("listeDateFin")));
75
		listesId.put("dateFin", Integer.valueOf(configuration.get("listeDateFin")));
76
		listesId.put("onp", Integer.valueOf(configuration.get("listeONP")));
76
		listesId.put("onp", Integer.valueOf(configuration.get("listeONP")));
77
		listesId.put("niveauImportance", Integer.valueOf(configuration.get("listeNiveauImportance")));
77
		listesId.put("niveauImportance", Integer.valueOf(configuration.get("listeNiveauImportance")));
78
		listesId.put("ea", Integer.valueOf(configuration.get("listeEA")));
78
		listesId.put("ea", Integer.valueOf(configuration.get("listeEA")));
79
		listesId.put("typeClassement", Integer.valueOf(configuration.get("listeTypeClassement")));
79
		listesId.put("typeClassement", Integer.valueOf(configuration.get("listeTypeClassement")));
80
		listesId.put("relationPersonneCollection", Integer.valueOf(configuration.get("listeRelationPersonneCollection")));
80
		listesId.put("relationPersonneCollection", Integer.valueOf(configuration.get("listeRelationPersonneCollection")));
81
		listesId.put("inventaireForme", Integer.valueOf(configuration.get("listeInventaireForme")));
81
		listesId.put("inventaireForme", Integer.valueOf(configuration.get("listeInventaireForme")));
82
		listesId.put("inventaireLogiciel", Integer.valueOf(configuration.get("listeInventaireLogiciel")));
82
		listesId.put("inventaireLogiciel", Integer.valueOf(configuration.get("listeInventaireLogiciel")));
83
		listesId.put("inventaireEtat", Integer.valueOf(configuration.get("listeInventaireEtat")));
83
		listesId.put("inventaireEtat", Integer.valueOf(configuration.get("listeInventaireEtat")));
84
		listesId.put("groupementPrincipe", Integer.valueOf(configuration.get("listeGroupementPrincipe")));
84
		listesId.put("groupementPrincipe", Integer.valueOf(configuration.get("listeGroupementPrincipe")));
85
		listesId.put("realisationBut", Integer.valueOf(configuration.get("listeRealisationBut")));
85
		listesId.put("realisationBut", Integer.valueOf(configuration.get("listeRealisationBut")));
86
		listesId.put("ion", Integer.valueOf(configuration.get("listeION")));
86
		listesId.put("ion", Integer.valueOf(configuration.get("listeION")));
87
		
87
		
88
		listesId.put("prefixe", Integer.valueOf(configuration.get("listePrefixes")));
88
		listesId.put("prefixe", Integer.valueOf(configuration.get("listePrefixes")));
89
		listesId.put("suffixes", Integer.valueOf(configuration.get("listeSuffixes")));
89
		listesId.put("suffixes", Integer.valueOf(configuration.get("listeSuffixes")));
90
		listesId.put("sexe", Integer.valueOf(configuration.get("listeSexe")));
90
		listesId.put("sexe", Integer.valueOf(configuration.get("listeSexe")));
91
		listesId.put("tel", Integer.valueOf(configuration.get("listeTel")));
91
		listesId.put("tel", Integer.valueOf(configuration.get("listeTel")));
92
		listesId.put("region", Integer.valueOf(configuration.get("listeRegions")));
92
		listesId.put("region", Integer.valueOf(configuration.get("listeRegions")));
-
 
93
		
-
 
94
		listesId.put("dureesIndexation", Integer.valueOf(configuration.get("listeDureesIndexation")));
-
 
95
		listesId.put("frequencesIndexation", Integer.valueOf(configuration.get("listeFrequencesIndexation")));
-
 
96
		
93
		listesId.put("nbElementsPage", Integer.valueOf(configuration.get("nbElementsPage")));
97
		listesId.put("nbElementsPage", Integer.valueOf(configuration.get("nbElementsPage")));
94
		
98
		
95
	}
99
	}
96
 
100
 
97
	/**
101
	/**
98
	 * Accesseur pour l'url de base du serveur jrest
102
	 * Accesseur pour l'url de base du serveur jrest
99
	 * 
103
	 * 
100
	 * @return une url de la forme http://emplacement_serveur/jrest
104
	 * @return une url de la forme http://emplacement_serveur/jrest
101
	 */
105
	 */
102
	public String getServiceBaseUrl() {
106
	public String getServiceBaseUrl() {
103
		return serviceBaseUrl;
107
		return serviceBaseUrl;
104
	}
108
	}
105
	
109
	
106
	/**
110
	/**
107
	 * Accesseur pour l'url de base du Carnet en Ligne
111
	 * Accesseur pour l'url de base du Carnet en Ligne
108
	 * 
112
	 * 
109
	 * @return une url de la forme http://emplacement_serveur/
113
	 * @return une url de la forme http://emplacement_serveur/
110
	 */
114
	 */
111
	public String getCelUrl() {
115
	public String getCelUrl() {
112
		return celUrl;
116
		return celUrl;
113
	}
117
	}
114
	
118
	
115
	/**
119
	/**
116
	 * Accesseur pour l'id d'une liste
120
	 * Accesseur pour l'id d'une liste
117
	 * 
121
	 * 
118
	 * @return l'identifiant de la liste ou null s'il n'est pas trouvé
122
	 * @return l'identifiant de la liste ou null s'il n'est pas trouvé
119
	 */
123
	 */
120
	public Integer getListeId(String code) {
124
	public Integer getListeId(String code) {
121
		if (listesId.containsKey(code)) {
125
		if (listesId.containsKey(code)) {
122
			return listesId.get(code);
126
			return listesId.get(code);
123
		}
127
		}
124
		return null;
128
		return null;
125
	}
129
	}
126
 
130
 
127
}
131
}