use of mom.trd.opentheso.bdd.datas.ConceptGroup in project opentheso by miledrousset.
the class GroupHelper method getThisConceptGroup2.
public ArrayList<NodeGroup> getThisConceptGroup2(HikariDataSource ds, String idConceptGroup, String idThesaurus, String idLang, ArrayList<NodeGroup> nodeConceptGroupList) throws SQLException {
Connection conn;
Statement stmt;
ResultSet resultSet;
NodeGroup nodeConceptGroup = null;
ConceptGroup conceptGroup = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT * from permuted where " + " id_group = '" + idConceptGroup + "'" + " and id_thesaurus = '" + idThesaurus + "'";
resultSet = stmt.executeQuery(query);
while (resultSet.next()) {
nodeConceptGroup = new NodeGroup();
int orden = resultSet.getInt(1);
nodeConceptGroup.setOrde(orden);
nodeConceptGroup.setId_concept(resultSet.getString("id_concept"));
nodeConceptGroup.setId_group(idConceptGroup);
nodeConceptGroup.setId_theso(idThesaurus);
nodeConceptGroup.setIdLang(resultSet.getString("id_lang"));
nodeConceptGroup.setLexicalValue(resultSet.getString("lexical_value"));
nodeConceptGroup.setIspreferredterm(resultSet.getBoolean("ispreferredterm"));
nodeConceptGroup.setOriginal_value(resultSet.getString("original_value"));
nodeConceptGroupList.add(nodeConceptGroup);
}
nodeConceptGroup.setConceptGroup(conceptGroup);
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while adding element : " + idThesaurus, sqle);
}
return nodeConceptGroupList;
}
use of mom.trd.opentheso.bdd.datas.ConceptGroup in project opentheso by miledrousset.
the class GroupHelper method getThisConceptGroup.
/**
* Permet de retourner un NodeConceptGroup par identifiant, par thésaurus et
* par langue / ou null si rien cette fonction ne retourne pas les détails
* et les traductions
*
* @param ds le pool de connexion
* @param idConceptGroup
* @param idThesaurus
* @param idLang
* @return Objet Class NodeConceptGroup
*/
public NodeGroup getThisConceptGroup(HikariDataSource ds, String idConceptGroup, String idThesaurus, String idLang) {
Connection conn;
Statement stmt;
ResultSet resultSet;
NodeGroup nodeConceptGroup = null;
ConceptGroup conceptGroup = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "SELECT * from concept_group where " + " idgroup = '" + idConceptGroup + "'" + " and idthesaurus = '" + idThesaurus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
resultSet.next();
if (resultSet.getRow() != 0) {
conceptGroup = new ConceptGroup();
conceptGroup.setIdgroup(idConceptGroup);
conceptGroup.setIdthesaurus(idThesaurus);
conceptGroup.setIdARk(resultSet.getString("id_ark"));
conceptGroup.setIdtypecode(resultSet.getString("idtypecode"));
conceptGroup.setNotation(resultSet.getString("notation"));
}
}
if (conceptGroup != null) {
query = "SELECT * FROM concept_group_label WHERE" + " idgroup = '" + conceptGroup.getIdgroup() + "'" + " AND idthesaurus = '" + idThesaurus + "'" + " AND lang = '" + idLang + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
nodeConceptGroup = new NodeGroup();
resultSet.next();
if (resultSet.getRow() == 0) {
// cas du Group non traduit
nodeConceptGroup.setLexicalValue("");
nodeConceptGroup.setIdLang(idLang);
} else {
nodeConceptGroup.setLexicalValue(resultSet.getString("lexicalvalue"));
nodeConceptGroup.setIdLang(idLang);
nodeConceptGroup.setCreated(resultSet.getDate("created"));
nodeConceptGroup.setModified(resultSet.getDate("modified"));
}
nodeConceptGroup.setConceptGroup(conceptGroup);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while adding element : " + idThesaurus, sqle);
}
return nodeConceptGroup;
}
use of mom.trd.opentheso.bdd.datas.ConceptGroup in project opentheso by miledrousset.
the class BackgroundTimeJob method synchroSparql.
private Runnable synchroSparql(int key) {
SynchroSparql run = new SynchroSparql();
run.setSparqlStruct(this.SparqlSyn.get(key));
ArrayList<Languages_iso639> listeLang = new LanguageHelper().getLanguagesOfThesaurus(this.connect.getPoolConnexion(), this.SparqlSyn.get(key).getThesaurus());
ArrayList<NodeLang> nol = new ArrayList<>();
for (Languages_iso639 lang : listeLang) {
NodeLang nd = new NodeLang();
nd.setValue(lang.getId_iso639_1());
nd.setCode(lang.getId_iso639_1());
nol.add(nd);
}
run.setListe_lang(nol);
ArrayList<String> nog = new GroupHelper().getListIdOfGroup(this.connect.getPoolConnexion(), this.SparqlSyn.get(key).getThesaurus());
ArrayList<NodeGroup> groupes = new ArrayList<>();
for (String group : nog) {
NodeGroup ng1 = new NodeGroup();
ng1.setId_group(group);
ConceptGroup cg = new ConceptGroup();
cg.setIdgroup(group);
ng1.setConceptGroup(cg);
groupes.add(ng1);
}
run.setListe_group(groupes);
run.setConn(this.connect);
return run;
}
Aggregations