use of mom.trd.opentheso.bdd.helper.TermHelper in project opentheso by miledrousset.
the class UnderTree method onNodeExpand.
/**
************************** ACTIONS TREE ***************************
*/
/**
* Expension de l'abre sur un seul noeud (ouvert manuellement)
* @param event Le noeud ouvert
*/
public void onNodeExpand(NodeExpandEvent event) {
String theso = ((MyTreeNode) event.getTreeNode()).getIdTheso();
String lang = ((MyTreeNode) event.getTreeNode()).getLangue();
// Récupération des facettes
ArrayList<Integer> listIdFacet = new FacetHelper().getIdFacetUnderConcept(connect.getPoolConnexion(), ((MyTreeNode) event.getTreeNode()).getIdConcept(), theso);
ArrayList<NodeFacet> listFacet = new ArrayList<>();
for (Integer id : listIdFacet) {
NodeFacet nf = new FacetHelper().getThisFacet(connect.getPoolConnexion(), id, theso, lang);
listFacet.add(nf);
}
// <Retirer noeuds fictifs>
if (event.getTreeNode().getChildCount() == 1) {
event.getTreeNode().getChildren().remove(0);
}
// Récupération et insertion des facettes avec leurs concepts
for (NodeFacet nf : listFacet) {
new MyTreeNode(1, String.valueOf(nf.getIdFacet()), theso, lang, "", "", "", "facette", nf.getLexicalValue() + "(" + String.valueOf(nf.getIdFacet()) + ")", event.getTreeNode());
ArrayList<String> listIdC = new FacetHelper().getIdConceptsOfFacet(connect.getPoolConnexion(), nf.getIdFacet(), theso);
ArrayList<NodeConceptTree> liste = new ArrayList<>();
for (String id : listIdC) {
String value = new TermHelper().getThisTerm(connect.getPoolConnexion(), id, theso, lang).getLexical_value();
NodeConceptTree nct = new NodeConceptTree();
nct.setHaveChildren(false);
nct.setIdConcept(id);
nct.setIdLang(lang);
nct.setIdThesaurus(theso);
nct.setTitle(value);
liste.add(nct);
}
// Ajout dans l'arbre
for (NodeConceptTree nct : liste) {
new MyTreeNode(3, nct.getIdConcept(), theso, lang, "", "", "", "fichier", nct.getTitle() + "(" + nct.getIdConcept() + ")", event.getTreeNode());
}
}
}
use of mom.trd.opentheso.bdd.helper.TermHelper in project opentheso by miledrousset.
the class NewTreeBean method loadOrphan.
public void loadOrphan(String idTheso, String langue) {
String typeNode, value = "";
/*
this.typeMot = type;
this.idMot = id;
this.idTheso = idT;
this.langue = l;
this.idDomaine = idD;
this.typeDomaine = typeDomaine;
this.idTopConcept = idTC;
*/
TreeNode dynamicTreeNode = (TreeNode) new MyTreeNode(1, null, idTheso, langue, null, null, null, "orphan", langueBean.getMsg("index.orphans"), root);
orphans = new OrphanHelper().getListOrphanId(connect.getPoolConnexion(), idTheso);
for (String idC : orphans) {
if (new ConceptHelper().haveChildren(connect.getPoolConnexion(), idTheso, idC)) {
typeNode = "dossier";
} else {
typeNode = "fichier";
}
Term term = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, langue);
if (term != null) {
value = term.getLexical_value() + " (id_" + idC + ")";
Concept temp = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idC, idTheso);
MyTreeNode mtn = new MyTreeNode(3, idC, idTheso, langue, "Orphan", null, null, typeNode, value, dynamicTreeNode);
if (typeNode.equals("dossier")) {
new DefaultTreeNode("fake", mtn);
}
}
}
}
use of mom.trd.opentheso.bdd.helper.TermHelper in project opentheso by miledrousset.
the class SelectedTerme method majLangueConcept.
public void majLangueConcept() {
langues = new ArrayList<>();
ArrayList<NodeTermTraduction> tempNTT = new TermHelper().getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
HashMap<String, String> tempMapL = new HashMap<>();
for (NodeTermTraduction ntt : tempNTT) {
tempMapL.put(ntt.getLang(), ntt.getLexicalValue());
}
langues.addAll(tempMapL.entrySet());
}
use of mom.trd.opentheso.bdd.helper.TermHelper in project opentheso by miledrousset.
the class SelectedTerme method editTerme.
/**
* Modifie le nom du terme selectionné
*
* @param cas
* @return
*/
public boolean editTerme(int cas) {
if (cas == 1) {
Term t = new Term();
t.setLexical_value(nomEdit);
t.setId_term(idT);
t.setId_thesaurus(idTheso);
t.setLang(idlangue);
new TermHelper().updateTermTraduction(connect.getPoolConnexion(), t, user.getUser().getId());
} else if (cas == 2) {
// le terme n'existe pas, il faut le créer
String idTerme = new TermHelper().getIdTermOfConcept(connect.getPoolConnexion(), idC, idTheso);
if (idTerme == null) {
return false;
}
Term termTemp = new Term();
termTemp.setId_concept(idC);
termTemp.setId_term(idTerme);
termTemp.setId_thesaurus(idTheso);
termTemp.setLang(idlangue);
termTemp.setLexical_value(nomEdit);
termTemp.setSource(String.valueOf(user.getUser().getId()));
new TermHelper().addTraduction(connect.getPoolConnexion(), termTemp, user.getUser().getId());
}
vue.setAddTInfo(0);
nom = nomEdit;
nomEdit = "";
return true;
}
use of mom.trd.opentheso.bdd.helper.TermHelper in project opentheso by miledrousset.
the class SelectedTerme method creerTermeSyno.
/**
* permet de créer des termes synonymes avec un type défini
*/
public void creerTermeSyno() {
editPassed = false;
if (valueEdit == null || valueEdit.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error1")));
return;
}
if (idT != null && !idT.equals("")) {
if (!duplicate) {
// on controle si a accepté un doublon ou non
if (new TermHelper().isTermExist(connect.getPoolConnexion(), valueEdit, idTheso, idlangue)) {
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
duplicate = true;
return;
}
if (new TermHelper().isAltLabelExist(connect.getPoolConnexion(), valueEdit, idTheso, idlangue)) {
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error7")));
duplicate = true;
return;
}
}
String leNom = valueEdit;
Term temp = new Term();
temp.setId_term(idT);
temp.setId_thesaurus(idTheso);
temp.setLang(idlangue);
temp.setLexical_value(valueEdit);
if (statutEdit.equalsIgnoreCase("Hidden")) {
temp.setHidden(true);
} else {
temp.setHidden(false);
}
temp.setStatus(statutEdit);
temp.setSource(String.valueOf(user.getUser().getName()));
if (!new TermHelper().addNonPreferredTerm(connect.getPoolConnexion(), temp, user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
return;
}
ArrayList<NodeEM> tempEM = new TermHelper().getNonPreferredTerms(connect.getPoolConnexion(), idT, idTheso, idlangue);
termesSynonymesE = new ArrayList<>();
termesSynonymesP = new ArrayList<>();
latitudLongitud = null;
for (NodeEM nem : tempEM) {
if (nem.getStatus().equalsIgnoreCase("USE")) {
termesSynonymesE.add(nem.getLexical_value());
}
if (nem.getStatus().equalsIgnoreCase("Hidden")) {
termesSynonymesP.add(nem.getLexical_value());
}
if (nem.getLexical_value().contains("WKT:")) {
latitudLongitud = nem.getLexical_value().substring(nem.getLexical_value().indexOf(":") + 1, nem.getLexical_value().length()).trim();
}
}
valueEdit = "";
nomEdit = "";
vue.setAddTSyno(0);
init();
PrimeFaces pf = PrimeFaces.current();
if (pf.isAjaxRequest()) {
pf.ajax().update("idTermeSynonymesEditDlg");
}
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", leNom + " " + langueBean.getMsg("sTerme.info1")));
} else {
vue.setAddTSyno(0);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error2")));
}
}
Aggregations