use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class AutoCompletBean method moveBrancheToTopTerm.
/**
* Déplace la branche vers la racine du Group (même
* Groupe/Domaine/Collection), la tete de la branche devient un TT
* (TopTerme)
*
* @return
*/
public boolean moveBrancheToTopTerm() {
// terme.getIdC = le concept sélectionné
try {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
/* if (selectedAtt == null || selectedAtt.getIdGroup().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
return false;
}*/
ConceptHelper conceptHelper = new ConceptHelper();
// au concept la relation TT
if (!conceptHelper.moveBranchToMT(conn, terme.getIdC(), idOld, terme.getIdDomaine(), terme.getIdTheso(), terme.getUser().getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("autoComp.info2")));
tree.reInit();
tree.reExpand();
selectedAtt = new NodeAutoCompletion();
return true;
} catch (SQLException ex) {
Logger.getLogger(AutoCompletBean.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class AutoCompletBean method getListTerm.
/**
* Fonction qui permet de retrouver les concepts dans un même Group en
* partant d'un concept
*
* @param query
* @return
*/
public List<NodeAutoCompletion> getListTerm(String query) {
selectedAtt = new NodeAutoCompletion();
List<NodeAutoCompletion> liste = new ArrayList<>();
if (theso.getThesaurus().getId_thesaurus() != null && theso.getThesaurus().getLanguage() != null) {
liste = new TermHelper().getAutoCompletionTerm(connect.getPoolConnexion(), // les termes qu'il faut éviter dans la recherche (le terme lui même et le BT)
terme.getIdC(), theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage(), terme.getIdDomaine(), query);
}
return liste;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class AutoCompletBean method addTGene.
/**
* Cette fonction permet d'ajouter une relation TG à un concept Le TG existe
* déjà dans le thésaurus, donc c'est une relation à créer
*
* @return
*/
public boolean addTGene() {
// terme.getIdTheso() est l'id du thésaurus
if (selectedAtt == null || selectedAtt.getIdConcept().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
return false;
}
if (selectedAtt.getIdConcept().equals(terme.getIdC())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.impossible")));
return false;
}
// addTermeGene(idNT, idBT)
if (!terme.addTermeGene(terme.getIdC(), selectedAtt.getIdConcept())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error2")));
return false;
}
tree.reInit();
tree.reExpand();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", selectedAtt.getTermLexicalValue() + " " + langueBean.getMsg("autoComp.info1")));
selectedAtt = new NodeAutoCompletion();
return true;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class AutoCompletBean method moveBrancheFromDomainToConcept.
/**
* Déplace la branche du thésaurus, d'un domaine à un concept
*
* @return
*/
public boolean moveBrancheFromDomainToConcept() {
if (selectedAtt == null || selectedAtt.getIdConcept().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
return false;
}
try {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
ConceptHelper conceptHelper = new ConceptHelper();
// au concept la relation TT
if (!conceptHelper.moveBranchFromMT(conn, terme.getIdC(), selectedAtt.getIdConcept(), terme.getIdDomaine(), terme.getIdTheso(), terme.getUser().getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("autoComp.info2")));
tree.reInit();
tree.reExpand();
selectedAtt = new NodeAutoCompletion();
return true;
} catch (SQLException ex) {
Logger.getLogger(AutoCompletBean.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion in project opentheso by miledrousset.
the class AutoCompletBean method newTAsso.
/**
* Ajoute un terme associé
*/
public void newTAsso() {
if (selectedAtt == null || selectedAtt.getIdConcept().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error1")));
} else {
if (terme.getIdC().equalsIgnoreCase(selectedAtt.getIdConcept())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("relation.errorRTNT")));
return;
}
if (!isAddRelationRTValid(terme.getIdC(), selectedAtt.getIdConcept())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("relation.errorRTNT")));
return;
}
Term laValeur = terme.getTerme(selectedAtt.getIdConcept());
if (laValeur == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.error2")));
} else {
terme.creerTermeAsso(selectedAtt.getIdConcept());
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", laValeur.getLexical_value() + " " + langueBean.getMsg("autoComp.info1")));
}
selectedAtt = new NodeAutoCompletion();
}
}
Aggregations