use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class SelectedTerme method creerTermeSpe.
/**
* *************************************** CREATION
* ****************************************
*/
/**
* Crée un nouveau terme spécifique au terme sélectionné
*
* @param selecedTerm
* @return true or false
*/
public boolean creerTermeSpe(MyTreeNode selecedTerm) {
ConceptHelper instance = new ConceptHelper();
if (user.nodePreference == null)
return false;
instance.setNodePreference(user.getNodePreference());
// 1 = domaine/Group, 2 = TT (top Term), 3 = Concept/term
if (selecedTerm.isIsSubGroup() || selecedTerm.isIsGroup()) {
// ici c'est le cas d'un Group ou Sous Group, on crée un TT Top Terme
Concept concept = new Concept();
concept.setIdGroup(selecedTerm.getIdConcept());
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("");
if (instance.addTopConcept(connect.getPoolConnexion(), idTheso, concept, terme, 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());
ConceptHelper ch = new ConceptHelper();
ArrayList<NodeConceptTree> tempNT = ch.getListTopConcepts(connect.getPoolConnexion(), idC, idTheso, idlangue);
termesSpecifique = new ArrayList<>();
HashMap<String, String> tempMap = new HashMap<>();
for (NodeConceptTree nct : tempNT) {
tempMap.put(nct.getIdConcept(), nct.getTitle());
}
termesSpecifique.addAll(tempMap.entrySet());
} else {
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.addConcept(connect.getPoolConnexion(), idP, concept, terme, 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.datas.Concept in project opentheso by miledrousset.
the class SearchBean method getNom.
public String getNom(String id) {
String nom;
ConceptHelper ch = new ConceptHelper();
Concept c = ch.getThisConcept(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus());
if (c == null) {
nom = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage());
} else {
nom = ch.getLexicalValueOfConcept(connect.getPoolConnexion(), id, theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage());
}
return nom;
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class SelectedCandidat method toInsert.
/**
* Passe un candidat de son état courant à l'état inséré. Les modifications
* nécessaires en bases de données sont traitées ici.
*
* @return
*/
public boolean toInsert() {
setPreferences();
if (selectedNvx == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error4")));
return false;
}
niveauEdit = selectedNvx.getIdConcept();
/*else {
niveauEdit = null;
}*/
/* if (domaineEdit == null || domaineEdit.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error1")));
return false;
}*/
GroupHelper groupHelper = new GroupHelper();
ArrayList<String> idGroups = groupHelper.getListIdGroupOfConcept(connect.getPoolConnexion(), idTheso, niveauEdit);
if (tradInsert.isEmpty()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sCdt.error2")));
return false;
}
if (new TermHelper().isTermExist(connect.getPoolConnexion(), selected.getValue().trim(), idTheso, langueTheso)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
return false;
}
if (idGroups.isEmpty()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "No Group Error !!"));
return false;
}
HashMap<String, String> trad = new HashMap<>();
if (tradInsert.contains(langueTheso)) {
trad.put(langueTheso, selected.getValue());
tradInsert.remove(langueTheso);
}
for (String l : tradInsert) {
for (NodeTraductionCandidat ntc : infoCdt.getNodeTraductions()) {
if (l.equals(ntc.getIdLang())) {
trad.put(l, ntc.getTitle());
}
}
}
ArrayList<Entry<String, String>> temp = new ArrayList<>(trad.entrySet());
ConceptHelper instance = new ConceptHelper();
instance.setNodePreference(user.getNodePreference());
Concept concept = new Concept();
concept.setIdGroup(idGroups.get(0));
concept.setIdThesaurus(idTheso);
concept.setStatus("D");
concept.setNotation("");
String langueTemp = temp.get(0).getKey();
Term terme = new Term();
terme.setId_thesaurus(idTheso);
terme.setLang(temp.get(0).getKey());
terme.setLexical_value(temp.get(0).getValue());
temp.remove(0);
String idc;
// if (niveauEdit == null || niveauEdit.trim().equals("")) { // Top concept
// idc = instance.addTopConcept(connect.getPoolConnexion(), idTheso, concept, terme, serverAdress, arkActive, theUser.getUser().getId());
// } else { // concept
idc = instance.addConcept(connect.getPoolConnexion(), niveauEdit, concept, terme, theUser.getUser().getId());
// permet d'ajouter les domaines au nouveau concept
for (String idGroup : idGroups) {
groupHelper.addConceptGroupConcept(connect.getPoolConnexion(), idGroup, niveauEdit, idTheso);
}
if (!temp.isEmpty()) {
String idt = new TermHelper().getThisTerm(connect.getPoolConnexion(), idc, idTheso, langueTemp).getId_term();
for (Entry<String, String> e : temp) {
terme = new Term();
terme.setId_concept(idc);
terme.setId_term(idt);
terme.setId_thesaurus(idTheso);
terme.setLang(e.getKey());
terme.setLexical_value(e.getValue());
new TermHelper().addTraduction(connect.getPoolConnexion(), terme, theUser.getUser().getId());
}
}
CandidateHelper ch = new CandidateHelper();
ch.updateCandidatStatus(connect.getPoolConnexion(), "i", idTheso, selected.getIdConcept());
ch.addAdminMessage(connect.getPoolConnexion(), selected.getIdConcept(), idTheso, theUser.getUser().getId(), msgValid);
// message d'alerte
/* ArrayList<NodeUser> contribs = ch.getListUsersOfCandidat(connect.getPoolConnexion(),
selected.getIdConcept(), idTheso);*/
/* for (NodeUser nodeUser : contribs) {
if (!lesMails.contains(contrib)) {
lesMails.add(contrib);
}
}*/
/*
for (NodeUser nodeUser : contribs) {
if (nodeUser.getMail() != null && !nodeUser.getMail().trim().equals("")) {
String message = "Votre candidat " + selected.getValue() + " a été intégré au thésaurus par le(a) terminologue : " + theUser.getUser().getName() + ".";
envoyerMailAlert(nodeUser.getMail(), message);
}
} */
msgValid = "";
selected.setEtat("i");
vue.setAddInsertCdt(false);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sCdt.info6")));
return true;
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class SelectedTerme method majTerme.
/**
* *************************************** MISE A JOUR
* ****************************************
*/
/**
* Met à jour le terme à la sélection d'un node de l'arbre (traitement
* différent si Domaine/TopConcept/Concept)
*
* @param sN
*/
public void majTerme(MyTreeNode sN) {
// contrôler si la connexion est toujour valide
// connect.
selectedNode = sN;
reInitTerme();
majPref();
idC = sN.getIdConcept();
idTheso = sN.getIdTheso();
idlangue = sN.getLangue();
idDomaine = sN.getIdCurrentGroup();
idTopConcept = sN.getIdTopConcept();
type = sN.getTypeConcept();
status = "";
notation = "";
latitudLongitud = null;
totalConceptOfBranch = "";
totalNoticesOfBranch = "";
majTAsso();
GroupHelper groupHelper = new GroupHelper();
ConceptHelper conceptHelper = new ConceptHelper();
if (groupHelper.isIdOfGroup(connect.getPoolConnexion(), idC, idTheso)) {
microTheso = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
NodeGroup ncg = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idC, idTheso, idlangue);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
nom = ncg.getLexicalValue();
idArk = ncg.getConceptGroup().getIdARk();
nomEdit = nom;
idT = "";
if (ncg.getCreated() != null && ncg.getModified() != null) {
dateC = dateFormat.format(ncg.getCreated());
dateM = dateFormat.format(ncg.getModified());
}
majGroupTGen();
majLangueGroup();
majTSpeGroup();
majNotes();
} else {
Concept concept = conceptHelper.getThisConcept(connect.getPoolConnexion(), idC, idTheso);
if (concept == null) {
return;
}
status = concept.getStatus();
notation = concept.getNotation();
if (!idDomaine.equals("Orphan")) {
majGroup();
majTGen();
} else {
microTheso = idDomaine;
}
Term t = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, idlangue);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
nom = t.getLexical_value();
nomEdit = nom;
idT = t.getId_term();
dateC = dateFormat.format(t.getCreated());
dateM = dateFormat.format(t.getModified());
creator = t.getCreator();
contributor = t.getContributor();
images = new ImagesHelper().getImage(connect.getPoolConnexion(), idC, idTheso, user.getUser().getId());
majNotes();
majLangueConcept();
majSyno();
updateGps();
majTSpeConcept();
align = new AlignmentHelper().getAllAlignmentOfConcept(connect.getPoolConnexion(), idC, idTheso);
// ResourceBundle bundlePref = getBundlePref();
if (user.getNodePreference().isZ3950actif()) {
majNoticeZ3950();
}
if (user.getNodePreference().isBddActive()) {
majNoticeBdd();
}
idArk = conceptHelper.getIdArkOfConcept(connect.getPoolConnexion(), idC, idTheso);
idHandle = conceptHelper.getIdHandleOfConcept(connect.getPoolConnexion(), idC, idTheso);
reInitFacette();
initTree();
}
}
use of mom.trd.opentheso.bdd.datas.Concept 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;
}
Aggregations