use of mom.trd.opentheso.bdd.datas.Term in project opentheso by miledrousset.
the class TermHelper method getTermsHistoriqueAll.
/**
* Cette fonction permet de récupérer l'historique d'un terme
*
* @param ds
* @param idTerm
* @param idThesaurus
* @param idLang
* @return Objet class Concept
*/
public ArrayList<Term> getTermsHistoriqueAll(HikariDataSource ds, String idTerm, String idThesaurus, String idLang) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<Term> nodeTermList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT lexical_value, modified, source, status, username FROM term_historique, users" + " WHERE id_term = '" + idTerm + "'" + " and id_thesaurus = '" + idThesaurus + "'" + " and lang ='" + idLang + "'" + " and term_historique.id_user=users.id_user" + " order by modified DESC, lexical_value ASC";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
nodeTermList = new ArrayList<>();
while (resultSet.next()) {
Term t = new Term();
t.setId_term(idTerm);
t.setId_thesaurus(idThesaurus);
t.setLexical_value(resultSet.getString("lexical_value"));
t.setModified(resultSet.getDate("modified"));
t.setSource(resultSet.getString("source"));
t.setStatus(resultSet.getString("status"));
t.setIdUser(resultSet.getString("username"));
t.setLang(idLang);
nodeTermList.add(t);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting all historique of Term : " + idTerm, sqle);
}
return nodeTermList;
}
Aggregations