Search in sources :

Example 11 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode 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 12 with MyTreeNode

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

the class SelectedTerme method onNodeSelect.

/**
 * Affiche les informations du terme correspondant au noeud selectionné dans
 * l'arbre
 *
 * @param event le noeud selectionné
 */
public void onNodeSelect(NodeSelectEvent event) {
    if (!event.getTreeNode().getType().equals("facette")) {
        MyTreeNode temp = (MyTreeNode) selectedNode;
        temp.setTypeConcept(3);
        majTerme(temp);
        setTree(2);
    } else {
        reInitTerme();
    }
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 13 with MyTreeNode

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

the class SelectedTerme method majIndexRapidSearch.

public void majIndexRapidSearch(String idThesaurus, String idLangue) {
    if (nodeSe == null) {
        return;
    }
    // cas du premier chargement du thésaurus
    if (nodeSe.getIdConcept() == null) {
        idTheso = idThesaurus;
    }
    if (idlangue.isEmpty()) {
        idlangue = idLangue;
    }
    if (nodeSe.isTopConcept()) {
        type = 2;
    } else {
        type = 3;
    }
    String idConcept = getSelectedTermComp().getIdConcept();
    MyTreeNode mtn = new MyTreeNode(type, idConcept, idTheso, idlangue, idDomaine, typeDomaine, null, null, getSelectedTermComp(), null);
    // nodeSe.getIdConcept(), nodeSe.getIdThesaurus(), nodeSe.getIdLang(), nodeSe.getIdGroup(), null, null, nodeSe.getLexical_value(), null);
    majTerme(mtn);
}
Also used : MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) PrefixString(com.k_int.IR.QueryModels.PrefixString)

Example 14 with MyTreeNode

use of mom.trd.opentheso.bdd.helper.nodes.MyTreeNode 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 15 with MyTreeNode

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

the class SelectedTerme method majSearchPermute.

public void majSearchPermute() {
    if (new ConceptHelper().isTopConcept(connect.getPoolConnexion(), nodePe.getIdConcept(), idTheso, nodePe.getIdGroup())) {
        type = 2;
    } else {
        type = 3;
    }
    String value = (nodePe.getFirstColumn() + " " + nodePe.getSearchedValue() + " " + nodePe.getLastColumn()).trim();
    MyTreeNode mtn = new MyTreeNode(type, nodePe.getIdConcept(), nodePe.getIdThesaurus(), nodePe.getIdLang(), nodePe.getIdGroup(), "", null, null, value, null);
    majTerme(mtn);
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) PrefixString(com.k_int.IR.QueryModels.PrefixString)

Aggregations

MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)25 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)12 TreeNode (org.primefaces.model.TreeNode)11 ArrayList (java.util.ArrayList)9 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)9 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)9 NodeConceptTree (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptTree)6 FacetHelper (mom.trd.opentheso.bdd.helper.FacetHelper)4 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)4 PrefixString (com.k_int.IR.QueryModels.PrefixString)3 FacesMessage (javax.faces.application.FacesMessage)3 Concept (mom.trd.opentheso.bdd.datas.Concept)2 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)2 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)2 NodeFacet (mom.trd.opentheso.bdd.helper.nodes.NodeFacet)2 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)2 StructIdBroaderTerm (mom.trd.opentheso.dragdrop.StructIdBroaderTerm)2 TreeChange (mom.trd.opentheso.dragdrop.TreeChange)2 Languages_iso639 (mom.trd.opentheso.bdd.datas.Languages_iso639)1 Term (mom.trd.opentheso.bdd.datas.Term)1