Subversion Repositories eFlore/Applications.coel

Rev

Rev 975 | Rev 989 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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