com.evasion.common.AbstractWebModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of COMMON Show documentation
Show all versions of COMMON Show documentation
API de l'application modulaire evasion-en-ligne
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.common;
import com.evasion.AbstractModule;
import java.security.Principal;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
/**
*
* @author sglon
*/
public class AbstractWebModule extends AbstractModule {
private String titreSite;
private String contactResp;
private String contactSuport;
private String analyticsAccount;
@Override
public Principal getPrincipal() {
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext extContext = ctx.getExternalContext();
return AbstractModule.glassfishWorkAround(((HttpServletRequest) extContext.getRequest()).getUserPrincipal());
}
protected void refreshParam() {
titreSite = getParamManager().getProperty(Constante.TITRE_SITE);
contactResp = getParamManager().getProperty(Constante.CONTACT_RESP);
contactSuport = getParamManager().getProperty(Constante.CONTACT_SUPPORT);
analyticsAccount = getParamManager().getProperty(Constante.ANALYTICS_ACCOUNT);
}
/**
* Getter du titre du site.
*
* @return titre du site;
*/
public String getTitreSite() {
return titreSite == null ? "" : titreSite;
}
/**
* Getter du mail du responsable.
*
* @return mail du responsable;
*/
public String getContactResp() {
return contactResp == null ? "" : contactResp;
}
/**
* Getter du mail du support technique.
*
* @return mail du support technique;
*/
public String getContactSupport() {
return contactSuport == null ? "" : contactSuport;
}
public boolean ifUserInRole(String var) {
return Utils.ifUserInRole(var);
}
public String getAnalyticsAccount() {
return analyticsAccount;
}
}