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();
}
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);
}
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);
}
}
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);
}
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;
}
Aggregations