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;
}
}
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);
}
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;
}
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;
}
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);
}
}
}
Aggregations