Search in sources :

Example 31 with NodeAutoCompletion

use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.

the class AutoCompletBean method newTSDupplicated.

/**
 * permet de créer un concept en doublon, après avoir eu la validation de l'utilisateur
 */
public void newTSDupplicated() {
    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") + " :", terme.getSelectedTermComp().getTermLexicalValue() + " " + langueBean.getMsg("tree.info1")));
    }
    terme.setSelectedTermComp(new NodeAutoCompletion());
    createValid = true;
    duplicate = false;
}
Also used : FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 32 with NodeAutoCompletion

use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.

the class AutoCompletBean method completNvxCandidat.

public List<NodeAutoCompletion> completNvxCandidat(String query) {
    selectedAtt = new NodeAutoCompletion();
    List<NodeAutoCompletion> liste = new TermHelper().getAutoCompletionTerm(connect.getPoolConnexion(), candidat.getIdTheso(), candidat.getLangueTheso(), query);
    return liste;
}
Also used : NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 33 with NodeAutoCompletion

use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.

the class AutoCompletBean method completSearchTerm.

public List<NodeAutoCompletion> completSearchTerm(String query) {
    selectedAtt = new NodeAutoCompletion();
    List<NodeAutoCompletion> liste = new ArrayList<>();
    if (theso.getThesaurus().getId_thesaurus() != null && theso.getThesaurus().getLanguage() != null) {
        liste = new TermHelper().getAutoCompletionTerm(connect.getPoolConnexion(), theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage(), query);
    }
    return liste;
}
Also used : ArrayList(java.util.ArrayList) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 34 with NodeAutoCompletion

use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.

the class FromMTconverter method getAsObject.

@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
    if (value != null && value.trim().length() > 0) {
        NodeAutoCompletion nac = new NodeAutoCompletion();
        nac.setIdConcept(value);
        nac.setIdGroup(value);
        return nac;
    } else {
        return null;
    }
}
Also used : NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)

Example 35 with NodeAutoCompletion

use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.

the class NewTreeBean method editNomT.

/**
 * Change le nom du terme courant avec mise à jour dans l'arbre Choix du
 * type de d'objet sélectionné (Group, sousGroup, Concept)
 */
public void editNomT() {
    duplicate = false;
    if (selectedTerme == null) {
        return;
    }
    // si c'est la même valeur, on fait rien
    if (selectedTerme.getNom().trim().equals(selectedTerme.getNomEdit())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
        return;
    }
    // saisie d'une valeur vide
    if (selectedTerme.getNomEdit().trim().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error1")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
        return;
    }
    // si le terme existe, il faut proposer le choix de valider ou non !!
    if (!forced) {
        // ici l'utilisateur a accepté de valider un doublon, donc on ne controle plus le terme
        if (new TermHelper().isTermExistForEdit(connect.getPoolConnexion(), selectedTerme.getNomEdit().trim(), idThesoSelected, selectedTerme.getIdT(), selectedTerme.getIdlangue())) {
            // traitement des doublons
            duplicate = true;
            editPassed = true;
            return;
        }
    }
    if (selectedTerme.getIdT() != null && !selectedTerme.getIdT().equals("")) {
        selectedTerme.editTerme(1);
    } else {
        // le terme n'existe pas encore
        if (!selectedTerme.editTerme(2)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
            selectedTerme.setNomEdit(selectedTerme.getNom());
            return;
        }
    }
    if (selectedNode != null) {
        // ((MyTreeNode) selectedNode).setData(temp + " (Id_" + selectedTerme.getIdC() + ")");
        ((MyTreeNode) selectedNode).setData(selectedTerme.getNom());
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", selectedTerme.getNom() + " " + langueBean.getMsg("tree.info2")));
        selectedTerme.setNomEdit(selectedTerme.getNom());
    }
    selectedTerme.setSelectedTermComp(new NodeAutoCompletion());
    forced = false;
    duplicate = false;
    editPassed = true;
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) FacesMessage(javax.faces.application.FacesMessage) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Aggregations

NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)41 FacesMessage (javax.faces.application.FacesMessage)17 ArrayList (java.util.ArrayList)16 Connection (java.sql.Connection)11 SQLException (java.sql.SQLException)11 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)8 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)7 ResultSet (java.sql.ResultSet)6 Statement (java.sql.Statement)6 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)6 StringPlus (mom.trd.opentheso.bdd.tools.StringPlus)6 PreparedStatement (java.sql.PreparedStatement)2 Term (mom.trd.opentheso.bdd.datas.Term)2 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)2 NodeCandidat (mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidat)2 NodeCandidatValue (mom.trd.opentheso.bdd.helper.nodes.candidat.NodeCandidatValue)2 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1