New file |
0,0 → 1,230 |
package org.tela_botanica.client.modeles.objets; |
|
import java.util.ArrayList; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
|
import com.google.gwt.i18n.client.Dictionary; |
import com.google.gwt.user.client.Window; |
|
/** |
* Classe chargeant certains paramètres de configuration à partir d'un fichier |
* javascript (config.js) |
* |
* @author aurelien |
* |
*/ |
public class Configuration { |
|
/** |
* L'url de base du serveur jrest |
*/ |
private static String serviceBaseUrl; |
|
private static String imageBaseUrl; |
|
private static String suiviBugUrl ; |
|
private static String aideBaseUrl ; |
|
private static String emailContact; |
|
private static String referentielGeo ; |
|
private static String cleGoogleMaps ; |
|
private static String lienEfloreBaseUrl; |
|
private static String refTax; |
|
private static String refTaxVersion; |
|
private static String licence =""; |
|
private static String formatOriginal = ""; |
|
private static String formatZoom = ""; |
|
private static String formatGalerie = ""; |
|
private static String formatListe = ""; |
|
private static String utiliseRedirectionImage; |
|
private static String imageRedirectUrl; |
|
private static String tailleMaxUpload; |
|
private static List<InfosReferentielNom> referentielsDispos; |
|
/** |
* Constructeur sans argument |
*/ |
public Configuration() { |
// on utilise le dictionnaire d'internationalisation pour lire les |
// variables du fichier javascript |
|
//if(GWT.isScript()) { |
serviceBaseUrl = Dictionary.getDictionary("configuration").get( |
"serviceBaseUrl"); |
|
emailContact = Dictionary.getDictionary("configuration").get( |
"emailContact"); |
|
suiviBugUrl = Dictionary.getDictionary("configuration").get( |
"suiviBugUrl"); |
|
imageBaseUrl = Dictionary.getDictionary("configuration").get( |
"imageBaseUrl"); |
|
aideBaseUrl = Dictionary.getDictionary("configuration").get( |
"aideBaseUrl"); |
|
referentielGeo = Dictionary.getDictionary("configuration").get( |
"referentielGeo"); |
|
cleGoogleMaps = Dictionary.getDictionary("configuration").get( |
"cleGoogleMaps"); |
|
lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get( |
"lienEfloreBaseUrl"); |
|
formatOriginal = Dictionary.getDictionary("configuration").get( |
"formatOriginal"); |
|
formatZoom = Dictionary.getDictionary("configuration").get( |
"formatZoom"); |
|
formatGalerie = Dictionary.getDictionary("configuration").get( |
"formatGalerie"); |
|
formatListe = Dictionary.getDictionary("configuration").get( |
"formatListe"); |
|
utiliseRedirectionImage = Dictionary.getDictionary("configuration").get( |
"utiliseRedirectionImage"); |
|
imageRedirectUrl = Dictionary.getDictionary("configuration").get( |
"imageRedirectUrl"); |
|
tailleMaxUpload = Dictionary.getDictionary("configuration").get( |
"tailleMaxUpload"); |
|
referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get( |
"referentielsDispos")); |
} |
|
private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) { |
String[] tabReferentiels = chaineListeReferentiels.split(";"); |
List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length); |
for (int i = 0; i < tabReferentiels.length; i++) { |
InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]); |
referentiels.add(infoRef); |
} |
return referentiels; |
} |
|
/** |
* Accesseur pour l'url de base du serveur jrest |
* |
* @return une url de la forme http://emplacement_serveur/jrest |
*/ |
public static String getServiceBaseUrl() { |
return serviceBaseUrl; |
} |
|
/** |
* Accesseur pour l'url de base du suivi de bug |
* |
* @return une url pointant vers le suivi des bugs |
*/ |
public static String getSuiviBugUrl() { |
return suiviBugUrl; |
} |
|
/** |
* Accesseur pour l'url de base des images |
* |
* @return une url pointant vers la racine du dossier contenant les images |
*/ |
public static String getImageBaseUrl() { |
return imageBaseUrl ; |
} |
|
/** |
* Accesseur pour l'url de base de l'aide |
* |
* @return une url pointant vers la racine de l'aide |
*/ |
public static String getAideBaseUrl() { |
return aideBaseUrl ; |
} |
|
/** |
* Accesseur pour l'email de contact du carnet en ligne |
* |
* @return une chaine contenant l'email de contact |
*/ |
public static String getEmailContact() { |
return emailContact; |
} |
|
/** |
* Accesseur pour le référentiel geo |
* |
* @return le référentiel geo |
*/ |
public static String getReferentielGeo() { |
return referentielGeo ; |
} |
|
/** |
* Accesseur pour la clé google maps |
* |
* @return la clé google maps |
*/ |
public static String getCleGoogleMaps() { |
return cleGoogleMaps ; |
} |
|
public static String getLienEfloreBaseUrl() { |
return lienEfloreBaseUrl; |
} |
|
public static String getLicence() { |
return licence; |
} |
|
public static String getFormatOriginal() { |
return formatOriginal; |
} |
|
public static String getFormatZoom() { |
return formatZoom; |
} |
|
public static String getFormatGalerie() { |
return formatGalerie; |
} |
|
public static String getFormatListe() { |
return formatListe; |
} |
|
public static boolean utiliseRedirectionImages() { |
return utiliseRedirectionImage.equals("1"); |
} |
|
public static String getImageRedirectUrl() { |
return imageRedirectUrl; |
} |
|
public static String getTailleMaxUpload() { |
return tailleMaxUpload; |
} |
|
public static List<InfosReferentielNom> getReferentielsDispos() { |
return referentielsDispos; |
} |
} |