Search in sources :

Example 91 with FacesMessage

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

the class GpsBeans method doAll.

/**
 * permet d'ajouter le coordonées gps automatique
 *
 * @param idC
 * @param id_Theso
 * @param id_user
 * @param langEnCour
 * @param idTerm
 * @return
 * @throws ParserConfigurationException
 */
public boolean doAll(String idC, String id_Theso, int id_user, String langEnCour, String idTerm) throws ParserConfigurationException {
    id_theso = id_Theso;
    id_concept = idC;
    boolean status = false;
    boolean found = false;
    if (codeid != null) {
        for (NodeAlignment na : listAlignValues) {
            if (na.getIdUrl() == null ? codeid == null : na.getIdUrl().equals(codeid) && !found) {
                alignment_choisi = na;
                found = true;
            }
        }
        if (found) {
            if (alignment_choisi == null) {
                return false;
            }
            latitud = alignment_choisi.getLat();
            longitud = alignment_choisi.getLng();
            addCoordinates(idC, id_Theso);
            if (alignementAutomatique) {
                status = alignementautomatique(idTerm);
            }
            if (integrerTraduction) {
                status = integreTraduction(idTerm, langEnCour);
            }
            if (listOfChildrenInConcept != null) {
                nextPosition();
            }
            selectedTerme.majLangueConcept();
            selectedTerme.setAlign(new AlignmentHelper().getAllAlignmentOfConcept(connect.getPoolConnexion(), idC, id_theso));
            initcoordonees();
        }
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", "Alignement OK"));
    return status;
}
Also used : NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) FacesMessage(javax.faces.application.FacesMessage)

Example 92 with FacesMessage

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

the class GpsBeans method validateParamretagesGps.

/**
 * Permet d'inserte dans la BDD les preferences du GPS pour cette Thesaurus
 *
 * @param id_Theso
 * @param id_lang
 * @param id_user
 */
public void validateParamretagesGps(String id_Theso, String id_lang, int id_user) {
    boolean status = true;
    if (selectedAlignement != null) {
        for (AlignementSource alignementSource : alignementSources) {
            if (alignementSource.getSource() == null ? selectedAlignement == null : alignementSource.getSource().equals(selectedAlignement)) {
                alignementPreferences = alignementSource;
            }
        }
        GpsHelper gpsHelper = new GpsHelper();
        if (!gpsHelper.garderPreferences(connect.getPoolConnexion(), id_Theso, integrerTraduction, remplacerTraduction, alignementAutomatique, alignementPreferences.getId(), id_user)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "Ne peux pas faire uptdate de preferences"));
            // message error
            status = false;
        }
    } else {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "Vous besoin selectionée une source"));
    }
    if (status) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", " validation de parametrisage fait!"));
    }
}
Also used : GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) FacesMessage(javax.faces.application.FacesMessage) AlignementSource(mom.trd.opentheso.core.alignment.AlignementSource)

Example 93 with FacesMessage

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

the class NewTreeBean method delSubGroup.

/**
 * Supprime le groupe sélectionné
 */
public void delSubGroup() {
    Connection conn;
    try {
        conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (!new GroupHelper().deleteConceptGroupRollBack(conn, selectedTerme.getIdC(), selectedTerme.getIdTheso(), selectedTerme.getUser().getUser().getIdUser())) {
            conn.rollback();
            conn.close();
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
            return;
        }
        // pour supprimer le Handle si c'est activé
        if (roleOnTheso.getNodePreference() != null) {
            if (roleOnTheso.getNodePreference().isUseHandle()) {
                HandleHelper handleHelper = new HandleHelper(roleOnTheso.getNodePreference());
                if (!handleHelper.deleteIdHandle(selectedTerme.getIdHandle(), selectedTerme.getIdTheso())) {
                    conn.rollback();
                    conn.close();
                    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
                    return;
                }
            }
        }
        conn.commit();
        conn.close();
    } catch (Exception e) {
        System.err.println(e.toString());
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("tree.info7")));
    reInit();
    initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
    selectedTerme.reInitTerme();
}
Also used : Connection(java.sql.Connection) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) FacesMessage(javax.faces.application.FacesMessage) HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper) IOException(java.io.IOException)

Example 94 with FacesMessage

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

the class NewTreeBean method fusionConcept.

/**
 * Fusionne les concepts avec mise à  jour dans l'abre
 */
public void fusionConcept() {
    if (selectedTerme.getConceptFusionId().equals(selectedTerme.getIdC())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error"), langueBean.getMsg("error")));
        selectedTerme.setConceptFusionId(null);
        selectedTerme.setConceptFusionAlign(null);
        selectedTerme.setConceptFusionNodeRT(null);
    } else {
        int idUser = selectedTerme.getUser().getUser().getIdUser();
        for (NodeRT rt : selectedTerme.getConceptFusionNodeRT()) {
            HierarchicalRelationship hr = new HierarchicalRelationship(rt.getIdConcept(), selectedTerme.getConceptFusionId(), selectedTerme.getIdTheso(), "RT");
            new ConceptHelper().addAssociativeRelation(connect.getPoolConnexion(), hr, idUser);
        }
        for (NodeAlignment na : selectedTerme.getConceptFusionAlign()) {
            new AlignmentHelper().addNewAlignment(connect.getPoolConnexion(), idUser, na.getConcept_target(), na.getThesaurus_target(), na.getUri_target(), na.getAlignement_id_type(), selectedTerme.getConceptFusionId(), selectedTerme.getIdTheso(), 0);
        }
        new ConceptHelper().addConceptFusion(connect.getPoolConnexion(), selectedTerme.getConceptFusionId(), selectedTerme.getIdC(), selectedTerme.getIdTheso(), idUser);
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("tree.info6")));
        reInit();
        reExpand();
    }
    selectedTerme.setSelectedTermComp(new NodeAutoCompletion());
    vue.setAddTInfo(0);
}
Also used : NodeRT(mom.trd.opentheso.bdd.helper.nodes.NodeRT) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HierarchicalRelationship(mom.trd.opentheso.bdd.datas.HierarchicalRelationship) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 95 with FacesMessage

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

the class NewTreeBean method renameGroup.

public boolean renameGroup() {
    MyTreeNode myTreeNode = (MyTreeNode) selectedNode;
    String valueEdit = selectedTerme.getNomEdit().trim();
    if (valueEdit.isEmpty()) {
        return false;
    }
    // si c'est la même valeur, on fait rien
    if (selectedTerme.getNom().trim().equals(valueEdit)) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
        // selectedTerme.setNomEdit(selectedTerme.getNom());
        return false;
    }
    // vérification si le Groupe à ajouter existe déjà
    if (new GroupHelper().isDomainExist(connect.getPoolConnexion(), valueEdit, myTreeNode.getIdTheso(), myTreeNode.getLangue())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
        return false;
    }
    if (myTreeNode.isIsGroup() || myTreeNode.isIsSubGroup()) {
        if (!selectedTerme.editGroupName(myTreeNode.getIdTheso(), myTreeNode.getIdConcept(), myTreeNode.getLangue(), valueEdit)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "erreur BDD"));
            // selectedTerme.setNomEdit(selectedTerme.getNom());
            return false;
        }
        myTreeNode.setData(valueEdit);
        selectedTerme.setNom(valueEdit);
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", valueEdit + " " + langueBean.getMsg("tree.info2")));
        return true;
    }
    return false;
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) FacesMessage(javax.faces.application.FacesMessage) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

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