New file |
0,0 → 1,88 |
package org.tela_botanica.client.modeles; |
|
import java.util.LinkedHashMap; |
|
import com.google.gwt.i18n.client.Dictionary; |
|
/** |
* Classe chargeant certains paramètres de configuration à partir d'un fichier |
* javascript (config.js) |
* |
* @author Aurélien PERONNET |
* |
*/ |
public class Configuration { |
|
/** |
* L'url de base du serveur jrest |
*/ |
private String serviceBaseUrl; |
|
/** |
* L'url de base du Carnet en Ligne |
*/ |
private String celUrl; |
|
/** |
* Tableau associatif contenant les identifiants des listes |
*/ |
private LinkedHashMap<String, Integer> listesId = new LinkedHashMap<String, Integer>(); |
|
/** |
* Constructeur sans argument |
*/ |
public Configuration() { |
// on utilise le dictionnaire d'internationalisation pour lire les variables du fichier javascript |
Dictionary configuration = Dictionary.getDictionary("configuration"); |
serviceBaseUrl = configuration.get("serviceBaseUrl"); |
celUrl = configuration.get("celUrl"); |
listesId.put("stpr", Integer.valueOf(configuration.get("listeStpr"))); |
listesId.put("stpu", Integer.valueOf(configuration.get("listeStpu"))); |
listesId.put("statut", Integer.valueOf(configuration.get("listeStatut"))); |
listesId.put("fonction", Integer.valueOf(configuration.get("listeFonction"))); |
listesId.put("botaAcronyme", Integer.valueOf(configuration.get("listeAcronymeBota"))); |
listesId.put("localStockage", Integer.valueOf(configuration.get("listeStockageLocal"))); |
listesId.put("meubleStockage", Integer.valueOf(configuration.get("listeStockageMeuble"))); |
listesId.put("parametreStockage", Integer.valueOf(configuration.get("listeStockageParametre"))); |
listesId.put("autreCollection", Integer.valueOf(configuration.get("listeCollectionAutre"))); |
listesId.put("opRestau", Integer.valueOf(configuration.get("listeRestaurationOperation"))); |
listesId.put("onep", Integer.valueOf(configuration.get("listeONEP"))); |
listesId.put("autreMateriel", Integer.valueOf(configuration.get("listeMaterielAutre"))); |
listesId.put("poisonTraitement", Integer.valueOf(configuration.get("listeEmpoisonnement"))); |
listesId.put("insecteTraitement", Integer.valueOf(configuration.get("listeDesinsectisation"))); |
listesId.put("actionValorisation", Integer.valueOf(configuration.get("listeValorisationAction"))); |
listesId.put("continentEtFr", Integer.valueOf(configuration.get("listeContinentEtFr"))); |
listesId.put("typeRecherche", Integer.valueOf(configuration.get("listeRechercheType"))); |
} |
|
/** |
* Accesseur pour l'url de base du serveur jrest |
* |
* @return une url de la forme http://emplacement_serveur/jrest |
*/ |
public String getServiceBaseUrl() { |
return serviceBaseUrl; |
} |
|
/** |
* Accesseur pour l'url de base du Carnet en Ligne |
* |
* @return une url de la forme http://emplacement_serveur/ |
*/ |
public String getCelUrl() { |
return celUrl; |
} |
|
/** |
* Accesseur pour l'id d'une liste |
* |
* @return l'identifiant de la liste ou null s'il n'est pas trouvé |
*/ |
public Integer getListeId(String code) { |
if (listesId.containsKey(code)) { |
return listesId.get(code); |
} |
return null; |
} |
|
} |