Search in sources :

Example 66 with ConceptHelper

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

the class NewTreeBean method changeGroupType.

public void changeGroupType(String type) {
    MyTreeNode myTN = (MyTreeNode) this.selectedNode;
    if (!myTN.isIsGroup() && !myTN.isIsSubGroup()) {
        // normalement impossible
        return;
    }
    if (myTN.getTypeDomaine().equals(type)) {
        return;
    } else {
        myTN.setTypeDomaine(type);
        GroupHelper gh = new GroupHelper();
        gh.updateTypeGroup(this.connect.getPoolConnexion(), type, idThesoSelected, myTN.getIdConcept());
        ConceptHelper ch = new ConceptHelper();
        this.onNodeExpand(myTN);
        for (TreeNode sbn : myTN.getChildren()) {
            if (((MyTreeNode) sbn).isIsSubGroup())
                changeGroupType(type, sbn);
        }
    }
    reInit();
    this.initTree(idThesoSelected, myTN.getLangue());
    reExpand();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 67 with ConceptHelper

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

the class NewTreeBean method onDragDrop.

/**
 * *******************fonctions drag drop #JM*****************************
 */
/**
 * ***********************************************************************
 */
/**
 * Fonction pour récupérer l'éveneme drag drop de l'arbre
 *
 * @param event
 */
public void onDragDrop(TreeDragDropEvent event) {
    MyTreeNode dragNode = (MyTreeNode) event.getDragNode();
    MyTreeNode dropNode = (MyTreeNode) event.getDropNode();
    idsBT = new ArrayList<>();
    idsBTRemoveNode = new ArrayList<>();
    TreeChange treeChange = new TreeChange();
    // int dropIndex = event.getDropIndex();
    this.draggedNode = dragNode;
    this.parentId = dragNode.getIdParent();
    this.droppedNode = dropNode;
    ArrayList<String> idsbt = null;
    RelationsHelper relationsHelper = new RelationsHelper();
    ConceptHelper conceptHelper = new ConceptHelper();
    GroupHelper groupHelper = new GroupHelper();
    if (dragNode.isIsTopConcept()) {
        idsbt = dragNode.getOtherGroup();
    } else {
        idsbt = relationsHelper.getListIdOfBT(connect.getPoolConnexion(), dragNode.getIdConcept(), idThesoSelected);
    }
    ArrayList<StructIdBroaderTerm> sibt = new ArrayList<>();
    for (String id : idsbt) {
        StructIdBroaderTerm elem = new StructIdBroaderTerm();
        String idLang = (selectedTerme.getIdlangue().isEmpty()) ? defaultLanguage : selectedTerme.getIdlangue();
        String idGroup = conceptHelper.getGroupIdOfConcept(connect.getPoolConnexion(), id, idThesoSelected);
        String lexicalValue = conceptHelper.getLexicalValueOfConcept(connect.getPoolConnexion(), id, idThesoSelected, idLang);
        String lexicalValueGroup = groupHelper.getLexicalValueOfGroup(connect.getPoolConnexion(), idGroup, idThesoSelected, idLang);
        elem.setIdBroaderTerm(id);
        elem.setIdGroupBroaderTerm(idGroup);
        elem.setLexicalValueTerm(lexicalValue);
        elem.setLexicalValueGroup(lexicalValueGroup);
        sibt.add(elem);
    }
    idsBT.addAll(sibt);
    if ("fichier".equals(event.getDropNode().getType())) {
        treeChange.changeLeafToDirectory(event.getDragNode(), event.getDropNode());
    }
    if (!"fichier".equals(event.getDropNode().getType()) && !"dossier".equals(event.getDropNode().getType())) {
        treeChange.changeToGroupChild(event.getDragNode(), event.getDropNode());
    }
    treeChange.saveExpandedNodes(root);
}
Also used : TreeChange(mom.trd.opentheso.dragdrop.TreeChange) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ArrayList(java.util.ArrayList) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) StructIdBroaderTerm(mom.trd.opentheso.dragdrop.StructIdBroaderTerm) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 68 with ConceptHelper

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

the class NewTreeBean method reExpand.

public void reExpand() {
    TreeChange tc = new TreeChange();
    tc.saveExpandedNodes(root);
    this.reInit();
    this.initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
    ArrayList<String> ids = new ArrayList<>();
    for (TreeNode tn : tc.getExpandedNodes()) {
        ids.add(((MyTreeNode) tn).getIdConcept());
    }
    ids.addAll(tc.getPathFromSelectedConcept(connect, (MyTreeNode) selectedNode));
    ids.add(selectedTerme.getIdC());
    // code pour forcer le depliment de l'arbre
    reExpandNodes(root, ids, selectedTerme.getIdC());
    if (selectedNode == null) {
    // selectedNode = new MyTreeNode(0, "", "", "", "", "", "domaine", "", root);
    }
    // selectedNode.setSelected(false);
    for (TreeNode tn : selectedNodes) {
        tn.setSelected(false);
    }
    selectedNodes = new ArrayList<>();
    ArrayList<String> first = new ArrayList<>();
    first.add(selectedTerme.getIdC());
    ArrayList<ArrayList<String>> paths = new ArrayList<>();
    paths = new ConceptHelper().getPathOfConcept(connect.getPoolConnexion(), selectedTerme.getIdC(), selectedTerme.getIdTheso(), first, paths);
    if (paths != null) {
    // reExpandTree(paths, selectedTerme.getIdTheso(), selectedTerme.getIdlangue(),tc);
    }
}
Also used : TreeChange(mom.trd.opentheso.dragdrop.TreeChange) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) ArrayList(java.util.ArrayList) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 69 with ConceptHelper

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

the class NewTreeBean method changeTerme.

public void changeTerme(String id, int type) {
    selectedNode.setSelected(false);
    for (TreeNode node : selectedNodes) {
        node.setSelected(false);
    }
    String idTC;
    if (((MyTreeNode) selectedNode).isIsGroup() || ((MyTreeNode) selectedNode).isIsSubGroup()) {
        // type == 2) { //On vient d'un domaine
        idTC = id;
    } else {
        idTC = selectedTerme.getIdTopConcept();
    }
    // / ????? à comprendre pourquoi ?????
    if (type == 0) {
        boolean temp = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), id, selectedTerme.getIdTheso()).isTopConcept();
        if (temp) {
            type = 2;
        } else {
            type = 3;
        }
    }
    MyTreeNode mTN = new MyTreeNode(type, id, selectedTerme.getIdTheso(), selectedTerme.getIdlangue(), selectedTerme.getIdDomaine(), selectedTerme.getTypeDomaine(), idTC, null, null, null);
    selectedTerme.majTerme(mTN);
    selectedNode = mTN;
    reExpand();
    vue.setOnglet(0);
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode) TreeNode(org.primefaces.model.TreeNode) DefaultTreeNode(org.primefaces.model.DefaultTreeNode) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Example 70 with ConceptHelper

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

the class NewTreeBean method deleteConcept.

/**
 * Permet de supprimer un concept seul, il ne faut pas qu'il est des fils,
 * sinon la suppression va échouer
 *
 * @return
 */
public boolean deleteConcept() {
    ConceptHelper conceptHelper = new ConceptHelper();
    if (selectedTerme.getUser().nodePreference == null) {
        return false;
    }
    conceptHelper.setNodePreference(selectedTerme.getUser().nodePreference);
    if (!conceptHelper.deleteConcept(connect.getPoolConnexion(), selectedTerme.getIdC(), selectedTerme.getIdTheso(), selectedTerme.getUser().getUser().getId())) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "La suppression a échoué !!"));
        return false;
    }
    reInit();
    initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
    selectedTerme.reInitTerme();
    selectedTerme.setSelectedNode((MyTreeNode) selectedNode.getParent());
    selectedTerme.majTerme((MyTreeNode) selectedNode.getParent());
    selectedNode = (MyTreeNode) selectedNode.getParent();
    reExpand();
    return true;
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) FacesMessage(javax.faces.application.FacesMessage)

Aggregations

ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)125 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)38 SQLException (java.sql.SQLException)36 Connection (java.sql.Connection)29 ArrayList (java.util.ArrayList)28 FacesMessage (javax.faces.application.FacesMessage)23 Concept (mom.trd.opentheso.bdd.datas.Concept)18 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)16 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)16 Term (mom.trd.opentheso.bdd.datas.Term)15 PrefixString (com.k_int.IR.QueryModels.PrefixString)14 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)14 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)13 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)12 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)12 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)12 HashMap (java.util.HashMap)9 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)9 NodeConceptExport (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport)9 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)9