Search in sources :

Example 6 with FacetHelper

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

the class UnderTree method initTree.

/**
 * Récupère les facettes pour remplir la racine de l'arbre selon la langue et le thésaurus sélectionnés
 * @param idTheso
 * @param langue
 */
public void initTree(String idTheso, String langue) {
    List<NodeConceptTree> racineNode = new FacetHelper().getIdParentOfFacet(connect.getPoolConnexion(), idTheso, langue);
    for (NodeConceptTree nct : racineNode) {
        TreeNode dynamicTreeNode = (TreeNode) new MyTreeNode(1, nct.getIdConcept(), idTheso, langue, "", "", "", "dossier", nct.getTitle() + "(" + nct.getIdConcept() + ")", root);
        new DefaultTreeNode("fake", dynamicTreeNode);
    }
}
Also used : NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 7 with FacetHelper

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);
    }
}
Also used : NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) ArrayList(java.util.ArrayList) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 8 with FacetHelper

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());
        }
    }
}
Also used : NodeConceptTree(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree) ArrayList(java.util.ArrayList) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) NodeFacet(mom.trd.opentheso.bdd.helper.nodes.NodeFacet) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) PrefixString(com.k_int.IR.QueryModels.PrefixString) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 9 with FacetHelper

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

the class SelectedThesaurus method getArrayFacette.

public ArrayList<Entry<String, String>> getArrayFacette() {
    if (connect.getPoolConnexion() != null) {
        if (thesaurus == null) {
            return arrayFacette;
        }
        ArrayList<NodeFacet> temp = new FacetHelper().getAllFacetsOfThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        Map<String, String> mapTemp = new HashMap<>();
        Term value;
        for (NodeFacet nf : temp) {
            value = new TermHelper().getThisTerm(connect.getPoolConnexion(), nf.getIdConceptParent(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
            if (value == null) {
                mapTemp.put(String.valueOf(nf.getIdFacet()), nf.getLexicalValue() + " (" + nf.getIdConceptParent() + ")");
            } else {
                mapTemp.put(String.valueOf(nf.getIdFacet()), nf.getLexicalValue() + " (" + value.getLexical_value() + ")");
            }
        }
        arrayFacette = new ArrayList<>(mapTemp.entrySet());
    }
    return arrayFacette;
}
Also used : HashMap(java.util.HashMap) NodeFacet(mom.trd.opentheso.bdd.helper.nodes.NodeFacet) FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) Term(mom.trd.opentheso.bdd.datas.Term) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 10 with FacetHelper

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

the class SelectedTerme method delFromFacet.

public void delFromFacet() {
    new FacetHelper().deleteConceptFromFacet(connect.getPoolConnexion(), Integer.parseInt(valueEdit), idC, idTheso);
    valueEdit = "";
    reInitFacette();
    initTree();
    vue.setAddFacette(false);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info11")));
}
Also used : FacetHelper(mom.trd.opentheso.bdd.helper.FacetHelper) FacesMessage(javax.faces.application.FacesMessage)

Aggregations

FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)13 FacesMessage (javax.faces.application.FacesMessage)6 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)5 NodeFacet (mom.trd.opentheso.bdd.helper.nodes.NodeFacet)5 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)4 NodeConceptTree (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree)4 PrefixString (com.k_int.IR.QueryModels.PrefixString)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)2 TreeNode (org.primefaces.model.TreeNode)2 Term (mom.trd.opentheso.bdd.datas.Term)1