Search in sources :

Example 31 with Term

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;
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) Term(mom.trd.opentheso.bdd.datas.Term) NodeTerm(mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)

Aggregations

Term (mom.trd.opentheso.bdd.datas.Term)31 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)22 Concept (mom.trd.opentheso.bdd.datas.Concept)15 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)15 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)13 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)12 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)11 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)10 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)10 FacesMessage (javax.faces.application.FacesMessage)9 SQLException (java.sql.SQLException)8 Connection (java.sql.Connection)7 ArrayList (java.util.ArrayList)7 PrefixString (com.k_int.IR.QueryModels.PrefixString)5 HashMap (java.util.HashMap)5 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)5 SKOSMapping (skos.SKOSMapping)5 SKOSTopConcept (skos.SKOSTopConcept)5 Statement (java.sql.Statement)4 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)4