use of mom.trd.opentheso.bdd.helper.RelationsHelper in project opentheso by miledrousset.
the class SelectedTerme method majTSpeConcept.
private void majTSpeConcept() {
termesSpecifique = new ArrayList<>();
ArrayList<NodeNT> tempNT = new RelationsHelper().getListNT(connect.getPoolConnexion(), idC, idTheso, idlangue);
writeTermesSpecifique(tempNT);
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper 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.RelationsHelper in project opentheso by miledrousset.
the class SelectedTerme method majTAsso.
private void majTAsso() {
termesAssocies = new ArrayList<>();
ArrayList<NodeRT> tempRT = new RelationsHelper().getListRT(connect.getPoolConnexion(), idC, idTheso, idlangue);
HashMap<String, String> tempMap = new HashMap<>();
for (NodeRT nrt : tempRT) {
if (nrt.getStatus().equals("hidden")) {
if (nrt.getTitle().isEmpty())
tempMap.put(nrt.getIdConcept(), "<del>" + nrt.getIdConcept() + " (" + nrt.getRole() + ")" + "</del>");
else
tempMap.put(nrt.getIdConcept(), "<del>" + nrt.getTitle() + " (" + nrt.getRole() + ")" + "</del>");
} else {
if (nrt.getTitle().isEmpty())
tempMap.put(nrt.getIdConcept(), nrt.getIdConcept() + " (" + nrt.getRole() + ")");
else
tempMap.put(nrt.getIdConcept(), nrt.getTitle() + " (" + nrt.getRole() + ")");
}
}
termesAssocies.addAll(tempMap.entrySet());
}
use of mom.trd.opentheso.bdd.helper.RelationsHelper 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.RelationsHelper 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