Search in sources :

Example 16 with RelationsHelper

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

the class SelectedTerme method majTSpeConcept.

private void majTSpeConcept() {
    termesSpecifique = new ArrayList<>();
    ArrayList<NodeNT> tempNT = new RelationsHelper().getListNT(connect.getPoolConnexion(), idC, idTheso, idlangue);
    writeTermesSpecifique(tempNT);
}
Also used : NodeNT(mom.trd.opentheso.bdd.helper.nodes.NodeNT) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Example 17 with RelationsHelper

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

the class SelectedTerme method creerSpecialTermeSpe.

/**
 * relation special type NTG NTP NTI ...
 *
 * @param selecedTerm
 * @param BTname
 * @param NTname
 * @return
 */
public boolean creerSpecialTermeSpe(MyTreeNode selecedTerm, String BTname, String NTname) {
    ConceptHelper instance = new ConceptHelper();
    if (user.nodePreference == null)
        return false;
    instance.setNodePreference(user.getNodePreference());
    Concept concept = new Concept();
    concept.setIdGroup(selecedTerm.getIdCurrentGroup());
    concept.setIdThesaurus(idTheso);
    concept.setStatus("D");
    concept.setNotation("");
    Term terme = new Term();
    terme.setId_thesaurus(idTheso);
    terme.setLang(idlangue);
    terme.setLexical_value(valueEdit);
    terme.setSource("");
    terme.setStatus("");
    // String idTC = idTopConcept;
    String idP = idC;
    if (instance.addConceptSpecial(connect.getPoolConnexion(), idP, concept, terme, BTname, NTname, user.getUser().getId()) == null) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", instance.getMessage()));
        return false;
    }
    // instance.insertID_grouptoPermuted(connect.getPoolConnexion(), concept.getIdThesaurus(), concept.getIdConcept());
    concept.getUserName();
    ArrayList<NodeNT> tempNT = new RelationsHelper().getListNT(connect.getPoolConnexion(), idC, idTheso, idlangue);
    termesSpecifique = new ArrayList<>();
    HashMap<String, String> tempMap = new HashMap<>();
    for (NodeNT nnt : tempNT) {
        tempMap.put(nnt.getIdConcept(), nnt.getTitle() + " (" + nnt.getRole() + ")");
    }
    termesSpecifique.addAll(tempMap.entrySet());
    vue.setAddTSpe(false);
    valueEdit = "";
    return true;
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) Term(mom.trd.opentheso.bdd.datas.Term) PrefixString(com.k_int.IR.QueryModels.PrefixString) FacesMessage(javax.faces.application.FacesMessage) NodeNT(mom.trd.opentheso.bdd.helper.nodes.NodeNT) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Example 18 with RelationsHelper

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

the class SelectedTerme method majTAsso.

private void majTAsso() {
    termesAssocies = new ArrayList<>();
    ArrayList<NodeRT> tempRT = new RelationsHelper().getListRT(connect.getPoolConnexion(), idC, idTheso, idlangue);
    HashMap<String, String> tempMap = new HashMap<>();
    for (NodeRT nrt : tempRT) {
        if (nrt.getStatus().equals("hidden")) {
            if (nrt.getTitle().isEmpty())
                tempMap.put(nrt.getIdConcept(), "<del>" + nrt.getIdConcept() + " (" + nrt.getRole() + ")" + "</del>");
            else
                tempMap.put(nrt.getIdConcept(), "<del>" + nrt.getTitle() + " (" + nrt.getRole() + ")" + "</del>");
        } else {
            if (nrt.getTitle().isEmpty())
                tempMap.put(nrt.getIdConcept(), nrt.getIdConcept() + " (" + nrt.getRole() + ")");
            else
                tempMap.put(nrt.getIdConcept(), nrt.getTitle() + " (" + nrt.getRole() + ")");
        }
    }
    termesAssocies.addAll(tempMap.entrySet());
}
Also used : NodeRT(mom.trd.opentheso.bdd.helper.nodes.NodeRT) HashMap(java.util.HashMap) PrefixString(com.k_int.IR.QueryModels.PrefixString) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Example 19 with RelationsHelper

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

the class SelectedTerme method addBranchGroup.

/**
 * Cette fonction permet d'ajouter un groupe à une branche
 *
 * @param newGroup
 * @param idConcept
 * @return
 */
public boolean addBranchGroup(ArrayList<String> newGroup, String idConcept) {
    try {
        Connection conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (new ConceptHelper().haveChildren(connect.getPoolConnexion(), idTheso, idConcept)) {
            List<NodeNT> children = new RelationsHelper().getListNT(connect.getPoolConnexion(), idConcept, idTheso, "");
            for (NodeNT nnt : children) {
                if (!addBranchGroup(newGroup, nnt.getIdConcept())) {
                    conn.rollback();
                    conn.close();
                    return false;
                }
            }
        }
        for (String s : newGroup) {
            if (!new ConceptHelper().haveThisGroup(connect.getPoolConnexion(), idConcept, s, idTheso)) {
                Concept c = new Concept();
                c.setIdConcept(idConcept);
                c.setIdGroup(s);
                c.setIdThesaurus(idTheso);
                c.setTopConcept(false);
                c.setStatus("D");
                if (!new GroupHelper().addConceptGroupConcept(conn, s, idConcept, idTheso)) {
                    // !new ConceptHelper().addNewGroupOfConcept(conn, c, user.getUser().getId())) {
                    conn.rollback();
                    conn.close();
                    return false;
                }
            }
        }
        conn.commit();
        conn.close();
        return true;
    } catch (SQLException ex) {
        Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) SQLException(java.sql.SQLException) Connection(java.sql.Connection) PrefixString(com.k_int.IR.QueryModels.PrefixString) NodeNT(mom.trd.opentheso.bdd.helper.nodes.NodeNT) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 20 with RelationsHelper

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

the class SelectedTerme method majGroupTGen.

private void majGroupTGen() {
    termeGenerique = new ArrayList<>();
    // On ajoute le domaine
    ArrayList<String> listIdGroup = new ConceptHelper().getListGroupParentIdOfGroup(connect.getPoolConnexion(), idC, idTheso);
    HashMap<String, String> tempMap = new HashMap<>();
    /*for (String group : listIdGroup) {
            tempMap.put(group, new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), group, idTheso, idlangue));
        }
        termeGenerique.addAll(tempMap.entrySet());*/
    ArrayList<NodeBT> tempBT = new RelationsHelper().getListBT(connect.getPoolConnexion(), idC, idTheso, idlangue);
    for (NodeBT nbt : tempBT) {
        HashMap<String, String> tempMap2 = new HashMap<>();
        if (nbt.getStatus().equals("hidden")) {
            tempMap2.put(nbt.getIdConcept(), "<del>" + nbt.getTitle() + " (" + nbt.getRole() + ")" + "</del>");
        } else {
            tempMap2.put(nbt.getIdConcept(), nbt.getTitle() + " (" + nbt.getRole() + ")");
        }
        termeGenerique.addAll(tempMap2.entrySet());
    }
}
Also used : NodeBT(mom.trd.opentheso.bdd.helper.nodes.NodeBT) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) PrefixString(com.k_int.IR.QueryModels.PrefixString) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper)

Aggregations

RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)26 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)14 PrefixString (com.k_int.IR.QueryModels.PrefixString)11 NodeNT (mom.trd.opentheso.bdd.helper.nodes.NodeNT)10 SQLException (java.sql.SQLException)8 HashMap (java.util.HashMap)8 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)8 Connection (java.sql.Connection)7 Concept (mom.trd.opentheso.bdd.datas.Concept)7 ArrayList (java.util.ArrayList)5 FacesMessage (javax.faces.application.FacesMessage)5 OrphanHelper (mom.trd.opentheso.bdd.helper.OrphanHelper)5 Term (mom.trd.opentheso.bdd.datas.Term)4 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)4 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)4 NodeBT (mom.trd.opentheso.bdd.helper.nodes.NodeBT)4 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)3 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)3 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)3 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)2