Search in sources :

Example 21 with ThesaurusHelper

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

the class SelectedThesaurus method preRenderView.

/**
 * récupère la variable URL et affiche le terme qu'elle désigne
 */
public void preRenderView() {
    // if the URL is for Concept
    if (idCurl != null && idTurl != null) {
        idLurl = Locale.getDefault().toString().substring(0, 2);
        ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
        if (temp.isEmpty()) {
            idCurl = null;
            idGurl = null;
            idTurl = null;
            return;
        } else {
            boolean lExist = false;
            for (Languages_iso639 l : temp) {
                if (l.getId_iso639_1().trim().equals(idLurl)) {
                    lExist = true;
                }
            }
            if (!lExist) {
                idLurl = temp.get(0).getId_iso639_1().trim();
            }
        }
        if (new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl) == null) {
            idCurl = null;
            idGurl = null;
            idTurl = null;
            return;
        }
        tree.getSelectedTerme().reInitTerme();
        // Initialisation du thésaurus et de l'arbre
        thesaurus.setId_thesaurus(idTurl);
        thesaurus.setLanguage(idLurl);
        tree.getSelectedTerme().reInitTerme();
        tree.reInit();
        tree.initTree(null, null);
        ThesaurusHelper th = new ThesaurusHelper();
        thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        user.initUserNodePref(idTurl);
        // Initialisation du terme séléctionné et de l'arbre
        int type;
        Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
        if (c.isTopConcept()) {
            type = 2;
        } else {
            type = 3;
        }
        tree.getSelectedTerme().setIdTheso(idTurl);
        tree.getSelectedTerme().setIdlangue(idLurl);
        MyTreeNode mTN = new MyTreeNode(type, idCurl, idTurl, idLurl, c.getIdGroup(), "", null, null, null, null);
        tree.getSelectedTerme().majTerme(mTN);
        tree.reExpand();
        idCurl = null;
        idGurl = null;
        idTurl = null;
        idLurl = null;
        return;
    }
    // if the URL is for Groups
    if (idGurl != null && idTurl != null) {
        idLurl = Locale.getDefault().toString().substring(0, 2);
        ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
        if (temp.isEmpty()) {
            idCurl = null;
            idGurl = null;
            idTurl = null;
            return;
        } else {
            boolean lExist = false;
            for (Languages_iso639 l : temp) {
                if (l.getId_iso639_1().trim().equals(idLurl)) {
                    lExist = true;
                }
            }
            if (!lExist) {
                idLurl = temp.get(0).getId_iso639_1().trim();
            }
        }
        if (new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idGurl, idTurl, idLurl) == null) {
            idCurl = null;
            idGurl = null;
            idTurl = null;
            return;
        }
        tree.getSelectedTerme().reInitTerme();
        // Initialisation du thésaurus et de l'arbre
        thesaurus.setId_thesaurus(idTurl);
        thesaurus.setLanguage(idLurl);
        tree.getSelectedTerme().reInitTerme();
        tree.reInit();
        tree.initTree(null, null);
        ThesaurusHelper th = new ThesaurusHelper();
        thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        user.initUserNodePref(idTurl);
        // Initialisation du terme séléctionné et de l'arbre
        int type = 1;
        // NodeGroup nodeGroup = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(),idGurl, idTurl, idLurl);
        /*
            Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
            if (c.isTopConcept()) {
                type = 2;
            } else {
                type = 3;
            }*/
        tree.getSelectedTerme().setIdTheso(idTurl);
        tree.getSelectedTerme().setIdlangue(idLurl);
        MyTreeNode mTN = new MyTreeNode(type, idGurl, idTurl, idLurl, idGurl, "", null, null, null, null);
        tree.getSelectedTerme().majTerme(mTN);
        tree.reExpand();
        idCurl = null;
        idGurl = null;
        idTurl = null;
        idLurl = null;
        return;
    }
    // if the URL is only for thésaurus
    if (idTurl != null) {
        idLurl = Locale.getDefault().toString().substring(0, 2);
        ArrayList<Languages_iso639> temp = new LanguageHelper().getLanguagesOfThesaurus(connect.getPoolConnexion(), idTurl);
        if (temp.isEmpty()) {
            idCurl = null;
            idGurl = null;
            idTurl = null;
            return;
        } else {
            boolean lExist = false;
            for (Languages_iso639 l : temp) {
                if (l.getId_iso639_1().trim().equals(idLurl)) {
                    lExist = true;
                }
            }
            if (!lExist) {
                idLurl = temp.get(0).getId_iso639_1().trim();
            }
        }
        /*   if (new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idGurl, idTurl, idLurl) == null) {
                idCurl = null;
                idGurl = null;
                idTurl = null;
                return;
            }*/
        tree.getSelectedTerme().reInitTerme();
        // Initialisation du thésaurus et de l'arbre
        thesaurus.setId_thesaurus(idTurl);
        thesaurus.setLanguage(idLurl);
        tree.getSelectedTerme().reInitTerme();
        tree.reInit();
        tree.initTree(null, null);
        ThesaurusHelper th = new ThesaurusHelper();
        thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        user.initUserNodePref(idTurl);
        // Initialisation du terme séléctionné et de l'arbre
        // NodeGroup nodeGroup = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(),idGurl, idTurl, idLurl);
        /*
            Concept c = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idCurl, idTurl);
            if (c.isTopConcept()) {
                type = 2;
            } else {
                type = 3;
            }*/
        tree.getSelectedTerme().setIdTheso(idTurl);
        tree.getSelectedTerme().setIdlangue(idLurl);
        // MyTreeNode mTN = new MyTreeNode(type, idGurl, idTurl, idLurl, idGurl, "", null, null, null);
        // tree.getSelectedTerme().majTerme(mTN);
        // tree.reExpand();
        idCurl = null;
        idGurl = null;
        idTurl = null;
        idLurl = null;
    }
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) LanguageHelper(mom.trd.opentheso.bdd.helper.LanguageHelper) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) Languages_iso639(mom.trd.opentheso.bdd.datas.Languages_iso639)

Example 22 with ThesaurusHelper

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

the class SelectedThesaurus method supprimerTradTheso.

/**
 * ************************************ EDITION TRAD BDD
 * *************************************
 */
/**
 * Suppréssion d'un traduction d'un thésaurus
 *
 * @param id l'identifiant du thésaurus
 * @param l la langue de la traduction à supprimer
 */
public void supprimerTradTheso(String id, String l) {
    new ThesaurusHelper().deleteThesaurusTraduction(connect.getPoolConnexion(), id, l);
    remplirArrayTrad(id);
}
Also used : ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Example 23 with ThesaurusHelper

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

the class ThesaurusDatas method exportAllDatas.

/**
 * permet de récupérer toutes les données d'un thésaurus
 * puis les chargées dans les variables de la classe
 *
 * @param ds
 * @param idThesaurus
 * @return
 */
public boolean exportAllDatas(HikariDataSource ds, String idThesaurus) {
    // récupération du thésaurus
    this.nodeThesaurus = new ThesaurusHelper().getNodeThesaurus(ds, idThesaurus);
    // récupération des groupes
    ArrayList<String> idGroups = new GroupHelper().getListIdOfGroup(ds, idThesaurus);
    for (String idGroup : idGroups) {
        this.nodeGroupLabels.add(new GroupHelper().getNodeGroupLabel(ds, idGroup, idThesaurus));
    // System.out.println("idGroup = : " + idGroup);
    }
    // récupération des ids des Tops Concepts
    nodeTTs = new ConceptHelper().getAllListIdsOfTopConcepts(ds, idThesaurus);
    // récupération de tous les concepts
    for (NodeTT nodeTT1 : nodeTTs) {
        new ConceptHelper().exportAllConcepts(ds, nodeTT1.getIdConcept(), idThesaurus, nodeConceptExports);
    }
    return true;
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeTT(mom.trd.opentheso.bdd.helper.nodes.NodeTT) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 24 with ThesaurusHelper

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

the class ImportSkosHelper method addDefaultThesaurus.

public boolean addDefaultThesaurus() {
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    thesaurus.setTitle("Theso1");
    if (thesaurus.getLanguage() == null) {
        thesaurus.setLanguage(langueSource);
    }
    if (!addThesaurusToBdd(thesaurusHelper)) {
        return false;
    }
    return true;
}
Also used : ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Example 25 with ThesaurusHelper

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

the class WriteSkosBDD method addLangsToThesaurus.

public void addLangsToThesaurus(HikariDataSource ds, String idThesaurus) {
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    ArrayList<String> tabListLang = thesaurusHelper.getAllUsedLanguagesOfThesaurus(ds, idThesaurus);
    for (int i = 0; i < tabListLang.size(); i++) {
        if (!thesaurusHelper.isLanguageExistOfThesaurus(ds, idThesaurus, tabListLang.get(i).trim())) {
            Thesaurus thesaurus = new Thesaurus();
            thesaurus.setId_thesaurus(idThesaurus);
            thesaurus.setContributor("");
            thesaurus.setCoverage("");
            thesaurus.setCreator("");
            thesaurus.setDescription("");
            thesaurus.setFormat("");
            thesaurus.setLanguage(tabListLang.get(i));
            thesaurus.setPublisher("");
            thesaurus.setRelation("");
            thesaurus.setRights("");
            thesaurus.setSource("");
            thesaurus.setSubject("");
            thesaurus.setTitle("theso_" + idThesaurus);
            thesaurus.setType("");
            thesaurusHelper.addThesaurusTraduction(ds, thesaurus);
        }
    }
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Aggregations

ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)31 Thesaurus (mom.trd.opentheso.bdd.datas.Thesaurus)10 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)9 FacesMessage (javax.faces.application.FacesMessage)7 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)7 UserHelper (mom.trd.opentheso.bdd.helper.UserHelper)6 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)6 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)4 LanguageHelper (mom.trd.opentheso.bdd.helper.LanguageHelper)3 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)3 NodeGroupLabel (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel)3 FacesContext (javax.faces.context.FacesContext)2 BaseDeDoneesHelper (mom.trd.opentheso.bdd.helper.BaseDeDoneesHelper)2 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)2 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)2 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)2 Concept (mom.trd.opentheso.bdd.datas.Concept)1 DcElement (mom.trd.opentheso.bdd.datas.DcElement)1