Search in sources :

Example 1 with FacesMessage

use of javax.faces.application.FacesMessage in project oxAuth by GluuFederation.

the class LogoutAction method logoutFailed.

public void logoutFailed() {
    String message = languageBean.getMessage("logout.failedToProceed");
    facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
    facesService.redirect("/error.xhtml");
}
Also used : FacesMessage(javax.faces.application.FacesMessage)

Example 2 with FacesMessage

use of javax.faces.application.FacesMessage in project opentheso by miledrousset.

the class AutoCompletBean method addTGeneOtherGroup.

/**
 * Cette fonction permet d'ajouter une relation TG d'unn autre Group
 * Le TG existe déjà dans le thésaurus, donc c'est une relation à créer
 * en ajoutant en plus le nouveau domaine à la branche
 *
 * // Auteur Miled Rousset
 *
 * @return
 */
public boolean addTGeneOtherGroup() {
    if (selectedAtt == null || selectedAtt.getIdConcept().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
        return false;
    }
    if (selectedAtt.getIdConcept().equals(terme.getIdC())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.impossible")));
        return false;
    }
    if (!terme.addTermeGeneOtherGroup(terme.getIdC(), terme.getIdDomaine(), selectedAtt.getIdConcept())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error2")));
        return false;
    }
    tree.reInit();
    tree.reExpand();
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", selectedAtt.getTermLexicalValue() + " " + langueBean.getMsg("autoComp.info1")));
    selectedAtt = new NodeAutoCompletion();
    return true;
}
Also used : FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 3 with FacesMessage

use of javax.faces.application.FacesMessage in project opentheso by miledrousset.

the class AutoCompletBean method newTSpe.

/**
 * Permet de créer un nouveau concept en vérifiant sa validité
 */
public void newTSpe() {
    createValid = false;
    terme.setValueEdit(terme.getSelectedTermComp().getTermLexicalValue());
    if (terme.getValueEdit().trim().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error1")));
        return;
    }
    String valueEdit = terme.getValueEdit().trim();
    // vérification si c'est le même nom, on fait rien
    if (valueEdit.equalsIgnoreCase(terme.getNom())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.impossible")));
        return;
    }
    // vérification si le term à ajouter existe déjà
    if (terme.isTermExist(valueEdit) != null) {
        duplicate = true;
        // FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
        return;
    }
    if (!terme.creerTermeSpe(((MyTreeNode) tree.getSelectedNode()))) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
        return;
    } else {
        tree.reInit();
        tree.reExpand();
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", valueEdit + " " + langueBean.getMsg("tree.info1")));
    }
    terme.setSelectedTermComp(new NodeAutoCompletion());
    createValid = true;
    PrimeFaces pf = PrimeFaces.current();
    if (pf.isAjaxRequest()) {
        pf.ajax().update("idNtEditDlg");
    }
// RequestContext.getCurrentInstance().update("idNtEditDlg");
}
Also used : PrimeFaces(org.primefaces.PrimeFaces) FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 4 with FacesMessage

use of javax.faces.application.FacesMessage in project opentheso by miledrousset.

the class AutoCompletBean method addTGene.

/**
 * Cette fonction permet d'ajouter une relation TG à un concept Le TG existe
 * déjà dans le thésaurus, donc c'est une relation à créer
 *
 * @return
 */
public boolean addTGene() {
    // terme.getIdTheso() est l'id du thésaurus
    if (selectedAtt == null || selectedAtt.getIdConcept().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
        return false;
    }
    if (selectedAtt.getIdConcept().equals(terme.getIdC())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.impossible")));
        return false;
    }
    // addTermeGene(idNT, idBT)
    if (!terme.addTermeGene(terme.getIdC(), selectedAtt.getIdConcept())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error2")));
        return false;
    }
    tree.reInit();
    tree.reExpand();
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", selectedAtt.getTermLexicalValue() + " " + langueBean.getMsg("autoComp.info1")));
    selectedAtt = new NodeAutoCompletion();
    return true;
}
Also used : FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 5 with FacesMessage

use of javax.faces.application.FacesMessage in project opentheso by miledrousset.

the class CurrentUser method updateAlertMail.

public boolean updateAlertMail() {
    try {
        UserHelper userHelper = new UserHelper();
        Connection conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (!userHelper.setAlertMailForUser(connect.getPoolConnexion().getConnection(), user.getId(), alertmail)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
            conn.rollback();
            conn.close();
            return false;
        }
        conn.commit();
        conn.close();
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("conf.alertMailMessage")));
        return true;
    } catch (SQLException ex) {
        Logger.getLogger(CurrentUser.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}
Also used : UserHelper(mom.trd.opentheso.bdd.helper.UserHelper) SQLException(java.sql.SQLException) Connection(java.sql.Connection) FacesMessage(javax.faces.application.FacesMessage)

Aggregations

FacesMessage (javax.faces.application.FacesMessage)370 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)43 SQLException (java.sql.SQLException)40 Connection (java.sql.Connection)34 FacesContext (javax.faces.context.FacesContext)25 ArrayList (java.util.ArrayList)24 UIInput (javax.faces.component.UIInput)24 ValidatorException (javax.faces.validator.ValidatorException)24 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)22 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)22 CandidateHelper (mom.trd.opentheso.bdd.helper.CandidateHelper)19 UserHelper2 (mom.trd.opentheso.bdd.helper.UserHelper2)19 IOException (java.io.IOException)16 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)15 Test (org.junit.Test)13 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)12 Term (mom.trd.opentheso.bdd.datas.Term)11 UploadedFile (org.primefaces.model.UploadedFile)11 HikariDataSource (com.zaxxer.hikari.HikariDataSource)10 Date (java.util.Date)10