use of mom.trd.opentheso.bdd.helper.RelationsHelper in project opentheso by miledrousset.
the class SelectedTerme method addTermeGeneOtherGroup.
/**
* Ajoute une relation terme générique au concept courant
*
* @param idConcept
* @param idGroup
* @param idNewConceptBT
* @return true or false
*/
public boolean addTermeGeneOtherGroup(String idConcept, String idGroup, String idNewConceptBT) {
ConceptHelper conceptHelper = new ConceptHelper();
RelationsHelper relationsHelper = new RelationsHelper();
GroupHelper groupHelper = new GroupHelper();
String idNewGroup = conceptHelper.getGroupIdOfConcept(connect.getPoolConnexion(), idNewConceptBT, idTheso);
if (idNewGroup == null) {
return false;
}
try {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
if (termeGenerique.isEmpty()) {
// c'était un orphelin
if (!new OrphanHelper().deleteOrphan(conn, idConcept, idTheso)) {
conn.rollback();
conn.close();
return false;
}
}
// On ajoute la realtion BT au concept
if (!relationsHelper.addRelationBT(conn, idConcept, idTheso, idNewConceptBT, user.getUser().getId())) {
conn.rollback();
conn.close();
return false;
}
// on récupère les Ids des concepts à modifier
ArrayList<String> lisIds = new ArrayList<>();
lisIds = conceptHelper.getIdsOfBranch(connect.getPoolConnexion(), idConcept, idTheso, lisIds);
// on ajoute le nouveau domaine à la branche
if (!groupHelper.addDomainToBranch(conn, lisIds, idNewGroup, idTheso, user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
} catch (SQLException ex) {
Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
termeGenerique = new ArrayList<>();
majTGen();
return true;
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper in project opentheso by miledrousset.
the class SelectedTerme method majTGen.
private void majTGen() {
termeGenerique = new ArrayList<>();
/*// On ajoute le domaine
ArrayList<String> listIdGroup = new ConceptHelper().getListGroupIdOfConcept(connect.getPoolConnexion(), idC, idTheso);
HashMap<String, String> tempMap = new HashMap<>();
for (String group : listIdGroup) {
tempMap.put(group, new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), group, idTheso, idlangue));
}
termeGenerique.addAll(tempMap.entrySet());*/
ArrayList<NodeBT> tempBT = new RelationsHelper().getListBT(connect.getPoolConnexion(), idC, idTheso, idlangue);
for (NodeBT nbt : tempBT) {
HashMap<String, String> tempMap2 = new HashMap<>();
if (nbt.getStatus().equals("hidden")) {
if (nbt.getTitle().isEmpty())
tempMap2.put(nbt.getIdConcept(), "<del>" + nbt.getIdConcept() + " (" + nbt.getRole() + ")" + "</del>");
else
tempMap2.put(nbt.getIdConcept(), "<del>" + nbt.getTitle() + " (" + nbt.getRole() + ")" + "</del>");
} else {
if (nbt.getTitle().isEmpty())
tempMap2.put(nbt.getIdConcept(), nbt.getIdConcept() + " (" + nbt.getRole() + ")");
else
tempMap2.put(nbt.getIdConcept(), nbt.getTitle() + " (" + nbt.getRole() + ")");
}
termeGenerique.addAll(tempMap2.entrySet());
}
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper in project opentheso by miledrousset.
the class SelectedTerme method majTSpeConceptOrder.
public void majTSpeConceptOrder() {
termesSpecifique = new ArrayList<>();
ArrayList<NodeNT> tempNT = new RelationsHelper().getListNTOrderByDate(connect.getPoolConnexion(), idC, idTheso, idlangue);
writeTermesSpecifique(tempNT);
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper in project opentheso by miledrousset.
the class HistoriqueBean method load.
public void load(String idThesaurus, String idConcept, String idTerm, String lang) {
if (typeHisto == 0 && dateHisto != null) {
conceptHisto = new ConceptHelper().getConceptHisoriqueFromDate(connect.getPoolConnexion(), idConcept, idThesaurus, dateHisto);
groupHisto = new GroupHelper().getGroupHistoriqueFromDate(connect.getPoolConnexion(), idConcept, idThesaurus, dateHisto);
noteHisto = new NoteHelper().getNoteHistoriqueFromDate(connect.getPoolConnexion(), idConcept, idThesaurus, idTerm, lang, dateHisto);
relationHisto = new RelationsHelper().getRelationHistoriqueFromDate(connect.getPoolConnexion(), idConcept, idThesaurus, dateHisto, lang);
nonPrefTermHisto = new TermHelper().getNonPreferredTermsHistoriqueFromDate(connect.getPoolConnexion(), idTerm, idThesaurus, lang, dateHisto);
termHisto = new TermHelper().getTermsHistoriqueFromDate(connect.getPoolConnexion(), idTerm, idThesaurus, lang, dateHisto);
} else if (typeHisto == 1) {
conceptHisto = new ConceptHelper().getConceptHisoriqueAll(connect.getPoolConnexion(), idConcept, idThesaurus);
groupHisto = new GroupHelper().getGroupHistoriqueAll(connect.getPoolConnexion(), idConcept, idThesaurus);
noteHisto = new NoteHelper().getNoteHistoriqueAll(connect.getPoolConnexion(), idConcept, idThesaurus, idTerm, lang);
relationHisto = new RelationsHelper().getRelationHistoriqueAll(connect.getPoolConnexion(), idConcept, idThesaurus, lang);
nonPrefTermHisto = new TermHelper().getNonPreferredTermsHistoriqueAll(connect.getPoolConnexion(), idTerm, idThesaurus, lang);
termHisto = new TermHelper().getTermsHistoriqueAll(connect.getPoolConnexion(), idTerm, idThesaurus, lang);
}
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper 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);
}
Aggregations