Search in sources :

Example 31 with TermHelper

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

the class SelectedTerme method majSyno.

private void majSyno() {
    termesSynonymesE = new ArrayList<>();
    termesSynonymesP = new ArrayList<>();
    ArrayList<NodeEM> tempEM = new TermHelper().getNonPreferredTerms(connect.getPoolConnexion(), idT, idTheso, idlangue);
    for (NodeEM nem : tempEM) {
        if (nem.getStatus().equalsIgnoreCase("USE")) {
            termesSynonymesE.add(nem.getLexical_value());
        } else {
            termesSynonymesP.add(nem.getLexical_value());
        }
    }
}
Also used : NodeEM(mom.trd.opentheso.bdd.helper.nodes.NodeEM) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 32 with TermHelper

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

the class SelectedTerme method modifierSynonyme.

public void modifierSynonyme() {
    int idUser = user.getUser().getId();
    Term term = new Term();
    term.setLexical_value(valueOfSynonymesToModify);
    term.setId_term(idT);
    term.setId_thesaurus(idTheso);
    term.setLang(idlangue);
    if (!new TermHelper().updateTermSynonyme(connect.getPoolConnexion(), oldValue, term, idUser)) {
    // ca va pas
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.modifySyn")));
    majSyno();
}
Also used : Term(mom.trd.opentheso.bdd.datas.Term) FacesMessage(javax.faces.application.FacesMessage) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 33 with TermHelper

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

the class SelectedTerme method delTrad.

/**
 * Supprime la traduction du terme pour la langue passée en paramètre
 *
 * @param lang
 */
public void delTrad(String lang) {
    new TermHelper().deleteTraductionOfTerm(connect.getPoolConnexion(), idT, lang, idTheso, user.getUser().getId());
    majLangueConcept();
    majNotes();
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info10")));
}
Also used : FacesMessage(javax.faces.application.FacesMessage) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 34 with TermHelper

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

the class SelectedTerme method getArrayFacette.

public ArrayList<Entry<String, String>> getArrayFacette() {
    if (connect.getPoolConnexion() == null) {
        return null;
    }
    ArrayList<Integer> temp = new FacetHelper().getIdFacetOfConcept(connect.getPoolConnexion(), idC, idTheso);
    Map<String, String> mapTemp = new HashMap<>();
    for (Integer i : temp) {
        NodeFacet nf = new FacetHelper().getThisFacet(connect.getPoolConnexion(), i, idTheso, idlangue);
        String value = new TermHelper().getThisTerm(connect.getPoolConnexion(), nf.getIdConceptParent(), idTheso, idlangue).getLexical_value();
        mapTemp.put(String.valueOf(nf.getIdFacet()), nf.getLexicalValue() + " (" + value + ")");
    }
    arrayFacette = new ArrayList<>(mapTemp.entrySet());
    return arrayFacette;
}
Also used : HashMap(java.util.HashMap) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) NodeFacet(mom.trd.opentheso.bdd.helper.nodes.NodeFacet) PrefixString(com.k_int.IR.QueryModels.PrefixString) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 35 with TermHelper

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

the class SelectedTerme method creerTradterme.

/**
 * Ajoute une traduction au terme courant et met l'affichage à jour
 */
public void creerTradterme() {
    if (valueEdit == null || valueEdit.trim().equals("")) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error3")));
        return;
    }
    boolean tradExist = false;
    // c'est le cas ou le concept n'a pas de traduction dans la langue en cours, il faut le mettre a jour dans l'arbre
    boolean newTraduction = false;
    for (Entry<String, String> e : langues) {
        if (e.getKey().equals(langueEdit)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
            tradExist = true;
            break;
        }
    }
    ConceptHelper ch = new ConceptHelper();
    TermHelper termHelper = new TermHelper();
    if (idT.isEmpty()) {
        newTraduction = true;
        String tmp = termHelper.getIdTermOfConcept(connect.getPoolConnexion(), idC, idTheso);
        if (tmp != null) {
            idT = tmp;
        }
    }
    // traduction du domaine
    if (type == 1 && !tradExist) {
        ConceptGroupLabel cgl = new ConceptGroupLabel();
        cgl.setLexicalvalue(valueEdit);
        cgl.setIdgroup(idDomaine);
        cgl.setIdthesaurus(idTheso);
        cgl.setLang(langueEdit);
        GroupHelper cgh = new GroupHelper();
        if (cgh.isDomainExist(connect.getPoolConnexion(), cgl.getLexicalvalue(), cgl.getIdthesaurus(), cgl.getLang())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
            return;
        }
        if (!cgh.addGroupTraduction(connect.getPoolConnexion(), cgl, user.getUser().getId())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error")));
            return;
        }
        ArrayList<NodeGroupTraductions> tempNGT = new GroupHelper().getGroupTraduction(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
        langues = new ArrayList<>();
        HashMap<String, String> tempMapL = new HashMap<>();
        for (NodeGroupTraductions ngt : tempNGT) {
            tempMapL.put(ngt.getIdLang(), ngt.getTitle());
        }
        if (newTraduction) {
            nom = cgh.getLexicalValueOfGroup(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
        }
        langues.addAll(tempMapL.entrySet());
    // traduction du TT
    } else if (type == 2 && !tradExist) {
        Term terme = new Term();
        terme.setId_thesaurus(idTheso);
        terme.setLang(langueEdit);
        terme.setLexical_value(valueEdit);
        terme.setId_term(idT);
        terme.setContributor(user.getUser().getId());
        terme.setCreator(user.getUser().getId());
        terme.setSource("");
        terme.setStatus("");
        if (termHelper.isTermExist(connect.getPoolConnexion(), terme.getLexical_value(), terme.getId_thesaurus(), terme.getLang())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
            return;
        }
        if (!ch.addTopConceptTraduction(connect.getPoolConnexion(), terme, user.getUser().getId())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error")));
            return;
        }
        ArrayList<NodeTermTraduction> tempNTT = termHelper.getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
        langues = new ArrayList<>();
        HashMap<String, String> tempMapL = new HashMap<>();
        for (NodeTermTraduction ntt : tempNTT) {
            tempMapL.put(ntt.getLang(), ntt.getLexicalValue());
        }
        if (newTraduction) {
            nom = termHelper.getThisTerm(connect.getPoolConnexion(), idC, idTheso, idlangue).getLexical_value();
        }
        langues.addAll(tempMapL.entrySet());
    // traduction des concepts
    } else if (type == 3 && !tradExist) {
        Term terme = new Term();
        terme.setId_thesaurus(idTheso);
        terme.setLang(langueEdit);
        terme.setLexical_value(valueEdit);
        terme.setId_term(idT);
        terme.setContributor(user.getUser().getId());
        terme.setCreator(user.getUser().getId());
        terme.setSource("");
        terme.setStatus("");
        if (termHelper.isTermExist(connect.getPoolConnexion(), terme.getLexical_value(), terme.getId_thesaurus(), terme.getLang())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
            return;
        }
        if (!ch.addConceptTraduction(connect.getPoolConnexion(), terme, user.getUser().getId())) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error")));
            return;
        }
        ArrayList<NodeTermTraduction> tempNTT = termHelper.getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
        langues = new ArrayList<>();
        HashMap<String, String> tempMapL = new HashMap<>();
        for (NodeTermTraduction ntt : tempNTT) {
            tempMapL.put(ntt.getLang(), ntt.getLexicalValue());
        }
        langues.addAll(tempMapL.entrySet());
        if (newTraduction) {
            nom = termHelper.getThisTerm(connect.getPoolConnexion(), idC, idTheso, idlangue).getLexical_value();
        }
    }
    langueEdit = "";
    valueEdit = "";
    if (!tradExist) {
        vue.setAddTrad(0);
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info2")));
    }
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) ConceptGroupLabel(mom.trd.opentheso.bdd.datas.ConceptGroupLabel) ArrayList(java.util.ArrayList) PrefixString(com.k_int.IR.QueryModels.PrefixString) Term(mom.trd.opentheso.bdd.datas.Term) NodeTermTraduction(mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction) NodeGroupTraductions(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupTraductions) FacesMessage(javax.faces.application.FacesMessage) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Aggregations

TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)45 Term (mom.trd.opentheso.bdd.datas.Term)22 ArrayList (java.util.ArrayList)16 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)16 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)14 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)13 Concept (mom.trd.opentheso.bdd.datas.Concept)12 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)11 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)10 FacesMessage (javax.faces.application.FacesMessage)9 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)9 PrefixString (com.k_int.IR.QueryModels.PrefixString)8 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)8 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)7 HashMap (java.util.HashMap)6 SQLException (java.sql.SQLException)5 FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)5 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)5 NodeFacet (mom.trd.opentheso.bdd.helper.nodes.NodeFacet)5 SKOSMapping (skos.SKOSMapping)5