use of mom.trd.opentheso.bdd.tools.StringPlus in project opentheso by miledrousset.
the class NoteHelper method updateTermNote.
/**
* Cette fonction permet de mettre à jour une note de Concept
*
* @param ds
* @param idTerm
* @param idLang
* @param idThesausus
* @param note
* @param noteTypeCode
* @param idUser
* @return
*/
public boolean updateTermNote(HikariDataSource ds, String idTerm, String idLang, String idThesausus, String note, String noteTypeCode, int idUser) {
Connection conn;
Statement stmt;
boolean status = false;
note = new StringPlus().convertString(note);
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "UPDATE note set" + " lexicalvalue = '" + note + "'," + " modified = current_date" + " WHERE lang ='" + idLang + "'" + " AND id_thesaurus = '" + idThesausus + "'" + " AND id_term = '" + idTerm + "'" + " AND notetypecode = '" + noteTypeCode + "'";
stmt.executeUpdate(query);
status = true;
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while updating Note of Term : " + idTerm, sqle);
}
addTermNoteHistorique(ds, idTerm, idLang, idThesausus, note, noteTypeCode, idUser);
return status;
}
use of mom.trd.opentheso.bdd.tools.StringPlus in project opentheso by miledrousset.
the class NoteHelper method getListNotesConceptAllLang.
/**
* Cette focntion permet de retourner la liste des notes pour un concept
* (type CustomNote, ScopeNote, HistoryNote) avec toutes les langues
*
* @param ds
* @param idConcept
* @param idThesaurus
* @return ArrayList des notes sous forme de Class NodeNote
*/
public ArrayList<NodeNote> getListNotesConceptAllLang(HikariDataSource ds, String idConcept, String idThesaurus) {
ArrayList<NodeNote> nodeNotes = new ArrayList<>();
Connection conn;
Statement stmt;
ResultSet resultSet;
StringPlus stringPlus = new StringPlus();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT note.id, note.notetypecode," + " note.lexicalvalue, note.created," + " note.modified, note.lang FROM note, note_type" + " WHERE note.notetypecode = note_type.code" + " and note_type.isconcept = true" + " and note.id_concept = '" + idConcept + "'" + " and note.id_thesaurus = '" + idThesaurus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
while (resultSet.next()) {
NodeNote nodeNote = new NodeNote();
nodeNote.setId_concept(idConcept);
nodeNote.setId_note(resultSet.getInt("id"));
nodeNote.setLang(resultSet.getString("lang"));
nodeNote.setLexicalvalue(stringPlus.normalizeStringForXml(resultSet.getString("lexicalvalue")));
nodeNote.setModified(resultSet.getDate("modified"));
nodeNote.setCreated(resultSet.getDate("created"));
nodeNote.setNotetypecode(resultSet.getString("notetypecode"));
nodeNotes.add(nodeNote);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting All Notes of Concept : " + idConcept, sqle);
}
return nodeNotes;
}
use of mom.trd.opentheso.bdd.tools.StringPlus in project opentheso by miledrousset.
the class NoteHelper method addTermNoteHistorique.
/**
* Cette fonction permet d'ajouter l'historique de l'ajout d'une Note à un
* term insert dans la table Note_hisorique
*
* @param ds
* @param idTerme
* @param idLang
* @param idThesausus
* @param note
* @param noteTypeCode
* @param idUser
* @return
*/
public boolean addTermNoteHistorique(HikariDataSource ds, String idTerme, String idLang, String idThesausus, String note, String noteTypeCode, int idUser) {
Connection conn;
Statement stmt;
boolean status = false;
note = new StringPlus().convertString(note);
try {
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "Insert into note_historique " + "(notetypecode, id_thesaurus, id_term, lang, lexicalvalue, id_user)" + " values (" + "'" + noteTypeCode + "'" + ",'" + idThesausus + "'" + ",'" + idTerme + "'" + ",'" + idLang + "'" + ",'" + note + "'" + ",'" + idUser + "')";
stmt.executeUpdate(query);
status = true;
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
log.error("Error while adding Note historique of term : " + idTerme, sqle);
}
return status;
}
use of mom.trd.opentheso.bdd.tools.StringPlus in project opentheso by miledrousset.
the class NoteHelper method addConceptNoteHistorique.
/**
* Cette fonction permet d'ajouter l'historique de l'ajout d'une Note à un
* concept insert dans la table Note_hisorique
*
* @param ds
* @param idConcept
* @param idLang
* @param idThesausus
* @param note
* @param noteTypeCode
* @param idUser
* @return
*/
public boolean addConceptNoteHistorique(HikariDataSource ds, String idConcept, String idLang, String idThesausus, String note, String noteTypeCode, int idUser) {
Connection conn;
Statement stmt;
boolean status = false;
note = new StringPlus().convertString(note);
try {
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "Insert into note_historique " + "(notetypecode, id_thesaurus, id_concept, lang, lexicalvalue, id_user)" + " values (" + "'" + noteTypeCode + "'" + ",'" + idThesausus + "'" + ",'" + idConcept + "'" + ",'" + idLang + "'" + ",'" + note + "'" + ",'" + idUser + "')";
stmt.executeUpdate(query);
status = true;
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
log.error("Error while adding Note historique of concept : " + idConcept, sqle);
}
return status;
}
use of mom.trd.opentheso.bdd.tools.StringPlus in project opentheso by miledrousset.
the class NoteHelper method addTermNote.
/**
* Cette fonction permet d'ajouter une Note à un Term instert dans la table
* Note
*
* @param ds
* @param idTerm
* @param idLang
* @param idThesaurus
* @param note
* @param noteTypeCode
* @param idUser
* @return
*/
public boolean addTermNote(HikariDataSource ds, String idTerm, String idLang, String idThesaurus, String note, String noteTypeCode, int idUser) {
Connection conn;
Statement stmt;
boolean status = false;
note = new StringPlus().convertString(note);
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "Insert into note " + "(notetypecode, id_thesaurus, id_term, lang, lexicalvalue)" + " values (" + "'" + noteTypeCode + "'" + ",'" + idThesaurus + "'" + ",'" + idTerm + "'" + ",'" + idLang + "'" + ",'" + note + "')";
stmt.executeUpdate(query);
status = true;
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while adding Note of Term : " + idTerm, sqle);
}
addTermNoteHistorique(ds, idTerm, idLang, idThesaurus, note, noteTypeCode, idUser);
return status;
}
Aggregations