use of mom.trd.opentheso.bdd.helper.FacetHelper in project opentheso by miledrousset.
the class SelectedTerme method initTree.
/**
* Récupère les concept pour remplir la racine de l'arbre des facette
*/
public void initTree() {
List<Integer> idFacettes = new FacetHelper().getIdFacetOfConcept(connect.getPoolConnexion(), idC, idTheso);
ArrayList<NodeConceptTree> racineNode = new ArrayList<>();
for (Integer i : idFacettes) {
racineNode.add(new FacetHelper().getConceptOnFacet(connect.getPoolConnexion(), i, idTheso, idlangue));
}
for (NodeConceptTree n : racineNode) {
TreeNode dynamicTreeNode;
if (n.getTitle().trim().isEmpty()) {
dynamicTreeNode = (TreeNode) new MyTreeNode(1, n.getIdConcept(), idTheso, idlangue, "", "", "", "dossier", n.getIdConcept(), root);
} else {
dynamicTreeNode = (TreeNode) new MyTreeNode(1, n.getIdConcept(), idTheso, idlangue, "", "", "", "dossier", n.getTitle(), root);
}
DefaultTreeNode defaultTreeNode = new DefaultTreeNode("fake", dynamicTreeNode);
defaultTreeNode.setExpanded(true);
}
}
use of mom.trd.opentheso.bdd.helper.FacetHelper in project opentheso by miledrousset.
the class SelectedThesaurus method tradFacette.
/**
* Ajoute une traduction pour une facette
*/
public void tradFacette() {
if (valueEdit == null || valueEdit.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error5")));
} else {
new FacetHelper().addFacetTraduction(connect.getPoolConnexion(), Integer.parseInt(idEdit), thesaurus.getId_thesaurus(), valueEdit, langueEdit.trim());
valueEdit = "";
vue.setFacette(false);
vue.setOnglet(2);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("theso.info6")));
}
}
use of mom.trd.opentheso.bdd.helper.FacetHelper in project opentheso by miledrousset.
the class SelectedThesaurus method updateFacette.
/**
* Change une traduction pour une facette
*/
public void updateFacette() {
if (valueEdit == null || valueEdit.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error8")));
} else {
new FacetHelper().updateFacetTraduction(connect.getPoolConnexion(), Integer.parseInt(idEdit), thesaurus.getId_thesaurus(), thesaurus.getLanguage(), valueEdit);
valueEdit = "";
uTree.reInit();
uTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
vue.setFacette(false);
vue.setOnglet(2);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("theso.info7")));
}
}
use of mom.trd.opentheso.bdd.helper.FacetHelper in project opentheso by miledrousset.
the class SelectedThesaurus method creerFacette.
/**
* *************************************** FACETTES
* ****************************************
*/
/**
* Insère une facette dans le thésaurus
*
* @param idParent
* @param editFacette
*/
public void creerFacette(String idParent, String editFacette) {
new FacetHelper().addNewFacet(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), idParent, editFacette, thesaurus.getLanguage(), "");
uTree.reInit();
uTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
vue.setFacette(false);
vue.setOnglet(2);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", editFacette + " " + langueBean.getMsg("theso.info4.2")));
}
use of mom.trd.opentheso.bdd.helper.FacetHelper in project opentheso by miledrousset.
the class SelectedTerme method onNodeExpand.
/**
* 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) {
String valeur = nf.getLexicalValue() + "(" + String.valueOf(nf.getIdFacet()) + ")";
new MyTreeNode(1, String.valueOf(nf.getIdFacet()), theso, lang, "", "", "", "facette", valeur, 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());
}
}
}
Aggregations