Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
60 jpm 1
package org.tela_botanica.client.modeles;
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")));
60 jpm 43
	}
44
 
45
	/**
46
	 * Accesseur pour l'url de base du serveur jrest
47
	 *
48
	 * @return une url de la forme http://emplacement_serveur/jrest
49
	 */
50
	public String getServiceBaseUrl() {
51
		return serviceBaseUrl;
52
	}
66 jpm 53
 
54
	/**
60 jpm 55
	 * Accesseur pour l'url de base du Carnet en Ligne
56
	 *
57
	 * @return une url de la forme http://emplacement_serveur/
58
	 */
59
	public String getCelUrl() {
60
		return celUrl;
61
	}
88 jpm 62
 
63
	/**
64
	 * Accesseur pour l'id d'une liste
65
	 *
66
	 * @return l'identifiant de la liste ou null s'il n'est pas trouvé
67
	 */
68
	public Integer getListeId(String code) {
69
		if (listesId.containsKey(code)) {
70
			return listesId.get(code);
71
		}
72
		return null;
73
	}
60 jpm 74
 
75
}