Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 111 Rev 165
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
	}
57
	}
57
 
58
 
58
	/**
59
	/**
59
	 * Accesseur pour l'url de base du serveur jrest
60
	 * Accesseur pour l'url de base du serveur jrest
60
	 * 
61
	 * 
61
	 * @return une url de la forme http://emplacement_serveur/jrest
62
	 * @return une url de la forme http://emplacement_serveur/jrest
62
	 */
63
	 */
63
	public String getServiceBaseUrl() {
64
	public String getServiceBaseUrl() {
64
		return serviceBaseUrl;
65
		return serviceBaseUrl;
65
	}
66
	}
66
	
67
	
67
	/**
68
	/**
68
	 * Accesseur pour l'url de base du Carnet en Ligne
69
	 * Accesseur pour l'url de base du Carnet en Ligne
69
	 * 
70
	 * 
70
	 * @return une url de la forme http://emplacement_serveur/
71
	 * @return une url de la forme http://emplacement_serveur/
71
	 */
72
	 */
72
	public String getCelUrl() {
73
	public String getCelUrl() {
73
		return celUrl;
74
		return celUrl;
74
	}
75
	}
75
	
76
	
76
	/**
77
	/**
77
	 * Accesseur pour l'id d'une liste
78
	 * Accesseur pour l'id d'une liste
78
	 * 
79
	 * 
79
	 * @return l'identifiant de la liste ou null s'il n'est pas trouvé
80
	 * @return l'identifiant de la liste ou null s'il n'est pas trouvé
80
	 */
81
	 */
81
	public Integer getListeId(String code) {
82
	public Integer getListeId(String code) {
82
		if (listesId.containsKey(code)) {
83
		if (listesId.containsKey(code)) {
83
			return listesId.get(code);
84
			return listesId.get(code);
84
		}
85
		}
85
		return null;
86
		return null;
86
	}
87
	}
87
 
88
 
88
}
89
}