use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedTerme method updateNotation.
/**
* *
* Nouvelles Fonctions par Miled Rousset
*/
/**
* permet de mettre à jour la notation d'un concept
*
* @return
*/
public boolean updateNotation() {
boolean status1 = false;
ConceptHelper conceptHelper = new ConceptHelper();
Connection conn;
try {
conn = connect.getPoolConnexion().getConnection();
if (conceptHelper.isNotationExist(conn, idTheso, notation)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("index.notationError")));
status1 = false;
conn.close();
}
conn.setAutoCommit(false);
if (!conceptHelper.updateNotation(conn, idC, idTheso, notation)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
status1 = false;
conn.rollback();
conn.close();
} else {
status1 = true;
conn.commit();
conn.close();
}
} catch (SQLException ex) {
Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
}
return status1;
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedTerme method majTSpeGroup.
private void majTSpeGroup() {
termesSpecifique = new ArrayList<>();
ConceptHelper ch = new ConceptHelper();
GroupHelper gh = new GroupHelper();
ArrayList<NodeConceptTree> tempNT = ch.getListTopConcepts(connect.getPoolConnexion(), idC, idTheso, idlangue);
for (NodeConceptTree nct : tempNT) {
HashMap<String, String> tempMap1 = new HashMap<>();
tempMap1.put(nct.getIdConcept(), nct.getTitle());
termesSpecifique.addAll(tempMap1.entrySet());
}
/*for(String tGroup : ch.getListGroupChildIdOfGroup(connect.getPoolConnexion(), idC, idTheso)){
String value = gh.getLexicalValueOfGroup(connect.getPoolConnexion(), tGroup, idTheso, idlangue);
HashMap<String, String> tempMap1 = new HashMap<>();
tempMap1.put(tGroup, value);
termesSpecifique.addAll(tempMap1.entrySet());
}*/
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedTerme method creerSpecialTermeSpe.
/**
* relation special type NTG NTP NTI ...
*
* @param selecedTerm
* @param BTname
* @param NTname
* @return
*/
public boolean creerSpecialTermeSpe(MyTreeNode selecedTerm, String BTname, String NTname) {
ConceptHelper instance = new ConceptHelper();
if (user.nodePreference == null)
return false;
instance.setNodePreference(user.getNodePreference());
Concept concept = new Concept();
concept.setIdGroup(selecedTerm.getIdCurrentGroup());
concept.setIdThesaurus(idTheso);
concept.setStatus("D");
concept.setNotation("");
Term terme = new Term();
terme.setId_thesaurus(idTheso);
terme.setLang(idlangue);
terme.setLexical_value(valueEdit);
terme.setSource("");
terme.setStatus("");
// String idTC = idTopConcept;
String idP = idC;
if (instance.addConceptSpecial(connect.getPoolConnexion(), idP, concept, terme, BTname, NTname, user.getUser().getId()) == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", instance.getMessage()));
return false;
}
// instance.insertID_grouptoPermuted(connect.getPoolConnexion(), concept.getIdThesaurus(), concept.getIdConcept());
concept.getUserName();
ArrayList<NodeNT> tempNT = new RelationsHelper().getListNT(connect.getPoolConnexion(), idC, idTheso, idlangue);
termesSpecifique = new ArrayList<>();
HashMap<String, String> tempMap = new HashMap<>();
for (NodeNT nnt : tempNT) {
tempMap.put(nnt.getIdConcept(), nnt.getTitle() + " (" + nnt.getRole() + ")");
}
termesSpecifique.addAll(tempMap.entrySet());
vue.setAddTSpe(false);
valueEdit = "";
return true;
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedTerme method addBranchGroup.
/**
* Cette fonction permet d'ajouter un groupe à une branche
*
* @param newGroup
* @param idConcept
* @return
*/
public boolean addBranchGroup(ArrayList<String> newGroup, String idConcept) {
try {
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
if (new ConceptHelper().haveChildren(connect.getPoolConnexion(), idTheso, idConcept)) {
List<NodeNT> children = new RelationsHelper().getListNT(connect.getPoolConnexion(), idConcept, idTheso, "");
for (NodeNT nnt : children) {
if (!addBranchGroup(newGroup, nnt.getIdConcept())) {
conn.rollback();
conn.close();
return false;
}
}
}
for (String s : newGroup) {
if (!new ConceptHelper().haveThisGroup(connect.getPoolConnexion(), idConcept, s, idTheso)) {
Concept c = new Concept();
c.setIdConcept(idConcept);
c.setIdGroup(s);
c.setIdThesaurus(idTheso);
c.setTopConcept(false);
c.setStatus("D");
if (!new GroupHelper().addConceptGroupConcept(conn, s, idConcept, idTheso)) {
// !new ConceptHelper().addNewGroupOfConcept(conn, c, user.getUser().getId())) {
conn.rollback();
conn.close();
return false;
}
}
}
conn.commit();
conn.close();
return true;
} catch (SQLException ex) {
Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedTerme method majGroupTGen.
private void majGroupTGen() {
termeGenerique = new ArrayList<>();
// On ajoute le domaine
ArrayList<String> listIdGroup = new ConceptHelper().getListGroupParentIdOfGroup(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")) {
tempMap2.put(nbt.getIdConcept(), "<del>" + nbt.getTitle() + " (" + nbt.getRole() + ")" + "</del>");
} else {
tempMap2.put(nbt.getIdConcept(), nbt.getTitle() + " (" + nbt.getRole() + ")");
}
termeGenerique.addAll(tempMap2.entrySet());
}
}
Aggregations