use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.
the class SelectedThesaurus method regenIdConcept.
/**
* Cette fonction remplace tout les id des concepts du théso
*/
private void regenIdConcept(Connection conn, String idTheso, ArrayList<String> idGroup) throws Exception {
/*récup les concepts*/
ConceptHelper conceptHelper = new ConceptHelper();
ArrayList<String> idConcepts = conceptHelper.getAllIdConceptOfThesaurus(conn, idTheso);
if (idConcepts == null || idConcepts.isEmpty()) {
throw new Exception("No concept in this thesaurus");
}
/*génération des nouveaux id*/
ArrayList<String> reservedId = idConcepts;
reservedId.addAll(idGroup);
ArrayList<String> newIdConcepts = createNewId(reservedId, idConcepts.size());
/*maj des tables*/
NoteHelper noteHelper = new NoteHelper();
GpsHelper gpsHelper = new GpsHelper();
ImagesHelper imagesHelper = new ImagesHelper();
AlignmentHelper alignmentHelper = new AlignmentHelper();
for (int i = 0; i < idConcepts.size(); i++) {
String id = idConcepts.get(i);
String newId = newIdConcepts.get(i);
// table concept
conceptHelper.setIdConcept(conn, idTheso, id, newId);
// table concept_group_concept
conceptHelper.setIdConceptGroupConcept(conn, idTheso, id, newId);
// table concept_historique
conceptHelper.setIdConceptHistorique(conn, idTheso, id, newId);
// table concept_orphan
conceptHelper.setIdConceptOrphan(conn, idTheso, id, newId);
// table gps
gpsHelper.setIdConceptGPS(conn, idTheso, id, newId);
// table hierarchical_relationship
conceptHelper.setIdConceptHieraRelation(conn, idTheso, id, newId);
// table hierarchical_relationship_historique
conceptHelper.setIdConceptHieraRelationHisto(conn, idTheso, id, newId);
// table note
noteHelper.setIdConceptNote(conn, idTheso, id, newId);
// table note_historique
noteHelper.setIdConceptNoteHisto(conn, idTheso, id, newId);
// table images
imagesHelper.setIdConceptImage(conn, idTheso, id, newId);
// table concept_fusion
conceptHelper.setIdConceptFusion(conn, idTheso, id, newId);
// table preferred_term
conceptHelper.setIdConceptPreferedTerm(conn, idTheso, id, newId);
// table alignement
alignmentHelper.setIdConceptAlignement(conn, idTheso, id, newId);
}
}
use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.
the class SelectedTerme method ajouterAlignAutoByLot.
/**
* Permet de creer une alignement, cette funtion s'utilise pour l'alignement
* par lot l'apelation de la funtion c'est de AlignementParLotBean
*
* @param nodeAlignment
* @return
*/
public boolean ajouterAlignAutoByLot(NodeAlignment nodeAlignment, boolean addDefinition, String id_term) {
AlignmentHelper alignmentHelper = new AlignmentHelper();
NoteHelper noteHelper = new NoteHelper();
if (!alignmentHelper.addNewAlignment(connect.getPoolConnexion(), user.getUser().getId(), nodeAlignment.getConcept_target(), nodeAlignment.getThesaurus_target(), nodeAlignment.getUri_target(), nodeAlignment.getAlignement_id_type(), nodeAlignment.getInternal_id_concept(), idTheso, alignementSource.getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
return false;
}
if (addDefinition) {
StringPlus stringPlus = new StringPlus();
String dejaBonString = stringPlus.clearAngles(nodeAlignment.getDef_target());
if (!noteHelper.addTermNote(connect.getPoolConnexion(), id_term, idlangue, idTheso, dejaBonString, "definition", user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Notation Error BDD")));
return false;
}
}
messageAlig = alignmentHelper.getMessage();
return true;
}
use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.
the class SelectedTerme method editNoteHisto.
/**
* Crée ou modifie la note historique du terme courant
*/
public void editNoteHisto() {
int idUser = user.getUser().getId();
if (noteHistorique.isEmpty()) {
deleteThisNoteOfConcept("note");
return;
}
if (new NoteHelper().isNoteExistOfTerm(connect.getPoolConnexion(), idT, idTheso, idlangue, "historyNote")) {
new NoteHelper().updateTermNote(connect.getPoolConnexion(), idT, idlangue, idTheso, noteHistorique, "historyNote", idUser);
} else {
new NoteHelper().addTermNote(connect.getPoolConnexion(), idT, idlangue, idTheso, noteHistorique, "historyNote", idUser);
}
majNotes();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info12")));
}
use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.
the class SelectedTerme method majNotes.
private void majNotes() {
// NodeNote contient la note avec le type de note, il faut filtrer pour trouver la bonne note
// For Concept : customnote ; scopeNote ; historyNote
// For Term : definition; editorialNote; historyNote;
initNotes();
nodeNoteTermList = new NoteHelper().getListNotesTerm(connect.getPoolConnexion(), idT, idTheso, idlangue);
for (NodeNote nodeNoteList1 : nodeNoteTermList) {
if (nodeNoteList1 != null) {
// cas d'une noteEditoriale
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("editorialNote")) {
if (nodeNoteList1.getLexicalvalue() != null) {
noteEditoriale = nodeNoteList1.getLexicalvalue();
}
}
// cas de definitionNote
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("definition")) {
if (nodeNoteList1.getLexicalvalue() != null) {
definition = nodeNoteList1.getLexicalvalue();
}
}
// cas de HistoryNote
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("historyNote")) {
if (nodeNoteList1.getLexicalvalue() != null) {
noteHistorique = nodeNoteList1.getLexicalvalue();
}
}
}
}
nodeNoteConceptList = new NoteHelper().getListNotesConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
for (NodeNote nodeNoteList1 : nodeNoteConceptList) {
if (nodeNoteList1 != null) {
// cas de Note d'application
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("scopeNote")) {
if (nodeNoteList1.getLexicalvalue() != null) {
noteApplication = nodeNoteList1.getLexicalvalue();
}
}
// cas de HistoryNote
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("historyNote")) {
if (nodeNoteList1.getLexicalvalue() != null) {
noteHistorique = nodeNoteList1.getLexicalvalue();
}
}
// cas de Note
if (nodeNoteList1.getNotetypecode().equalsIgnoreCase("note")) {
if (nodeNoteList1.getLexicalvalue() != null) {
note = nodeNoteList1.getLexicalvalue();
}
}
}
}
}
use of mom.trd.opentheso.bdd.helper.NoteHelper in project opentheso by miledrousset.
the class SelectedTerme method deleteThisNoteOfConcept.
/**
* Cette fonction permet de supprimer une note suivant son type
*
* @param noteTypeCode
*/
public void deleteThisNoteOfConcept(String noteTypeCode) {
int idUser = user.getUser().getId();
new NoteHelper().deletethisNoteOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue, noteTypeCode);
majNotes();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info13")));
}
Aggregations