Search in sources :

Example 76 with ConceptHelper

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

the class SelectedTerme method updateNotation.

/**
 * *
 * Nouvelles Fonctions par Miled Rousset
 */
/**
 * permet de mettre à jour la notation d'un concept
 *
 * @return
 */
public boolean updateNotation() {
    boolean status1 = false;
    ConceptHelper conceptHelper = new ConceptHelper();
    Connection conn;
    try {
        conn = connect.getPoolConnexion().getConnection();
        if (conceptHelper.isNotationExist(conn, idTheso, notation)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("index.notationError")));
            status1 = false;
            conn.close();
        }
        conn.setAutoCommit(false);
        if (!conceptHelper.updateNotation(conn, idC, idTheso, notation)) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
            status1 = false;
            conn.rollback();
            conn.close();
        } else {
            status1 = true;
            conn.commit();
            conn.close();
        }
    } catch (SQLException ex) {
        Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
    }
    return status1;
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) SQLException(java.sql.SQLException) Connection(java.sql.Connection) FacesMessage(javax.faces.application.FacesMessage)

Example 77 with ConceptHelper

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

the class SelectedTerme method majTSpeGroup.

private void majTSpeGroup() {
    termesSpecifique = new ArrayList<>();
    ConceptHelper ch = new ConceptHelper();
    GroupHelper gh = new GroupHelper();
    ArrayList<NodeConceptTree> tempNT = ch.getListTopConcepts(connect.getPoolConnexion(), idC, idTheso, idlangue);
    for (NodeConceptTree nct : tempNT) {
        HashMap<String, String> tempMap1 = new HashMap<>();
        tempMap1.put(nct.getIdConcept(), nct.getTitle());
        termesSpecifique.addAll(tempMap1.entrySet());
    }
/*for(String tGroup : ch.getListGroupChildIdOfGroup(connect.getPoolConnexion(), idC, idTheso)){
            
            String value  = gh.getLexicalValueOfGroup(connect.getPoolConnexion(), tGroup, idTheso, idlangue);
            HashMap<String, String> tempMap1 = new HashMap<>();
            tempMap1.put(tGroup, value);
            termesSpecifique.addAll(tempMap1.entrySet());
        }*/
}
Also used : NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) HashMap(java.util.HashMap) PrefixString(com.k_int.IR.QueryModels.PrefixString) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 78 with ConceptHelper

use of mom.trd.opentheso.bdd.helper.ConceptHelper 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 79 with ConceptHelper

use of mom.trd.opentheso.bdd.helper.ConceptHelper 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 80 with ConceptHelper

use of mom.trd.opentheso.bdd.helper.ConceptHelper 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

ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)125 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)38 SQLException (java.sql.SQLException)36 Connection (java.sql.Connection)29 ArrayList (java.util.ArrayList)28 FacesMessage (javax.faces.application.FacesMessage)23 Concept (mom.trd.opentheso.bdd.datas.Concept)18 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)16 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)16 Term (mom.trd.opentheso.bdd.datas.Term)15 PrefixString (com.k_int.IR.QueryModels.PrefixString)14 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)14 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)13 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)12 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)12 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)12 HashMap (java.util.HashMap)9 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)9 NodeConceptExport (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport)9 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)9