All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evasion.common.AbstractWebModule Maven / Gradle / Ivy

There is a newer version: 2.0.0.2
Show newest version
/*
 * 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy