Search in sources :

Example 26 with RelationsHelper

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

the class TreeChange method moveTopTermToConceptOtherDomaine.

public boolean moveTopTermToConceptOtherDomaine(Connexion connect, String idConceptOrigin, String idBT, String idOriginGroup, String targetidConcept, String targetIGroup, String idThesoSelected, int id) {
    try {
        Connection conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        GroupHelper groupHelper = new GroupHelper();
        ConceptHelper conceptHelper = new ConceptHelper();
        RelationsHelper relationHelper = new RelationsHelper();
        // on récupère les Ids des concepts à modifier
        ArrayList<String> lisIds = new ArrayList<>();
        lisIds = conceptHelper.getIdsOfBranch(connect.getPoolConnexion(), idConceptOrigin, idThesoSelected, lisIds);
        if (!groupHelper.deleteAllDomainOfBranch(conn, lisIds, idOriginGroup, idThesoSelected)) {
            conn.rollback();
            conn.close();
            return false;
        }
        if (!groupHelper.addDomainToBranch(conn, lisIds, targetIGroup, idThesoSelected, id)) {
            conn.rollback();
            conn.close();
            return false;
        }
        if (!relationHelper.addRelationBT(conn, idConceptOrigin, idThesoSelected, targetidConcept, id)) {
            conn.rollback();
            conn.close();
            return false;
        }
        if (!relationHelper.deleteRelationTT(conn, idConceptOrigin, idThesoSelected, id)) {
            conn.rollback();
            conn.close();
            return false;
        }
        conn.commit();
        conn.close();
        return true;
    } catch (SQLException ex) {
        Logger.getLogger(AutoCompletBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return false;
}
Also used : AutoCompletBean(mom.trd.opentheso.SelectedBeans.AutoCompletBean) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ArrayList(java.util.ArrayList) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) 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