use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.
the class ThesaurusHelper method getNodeThesaurus.
/**
* Permet de retourner un thésaurus par identifiant sous forme de
* NodeThesaurus avec les traductions
*
* @param ds le pool de connexion
* @param idThesaurus
* @return Objet Class Thesaurus
*/
public NodeThesaurus getNodeThesaurus(HikariDataSource ds, String idThesaurus) {
ArrayList<Languages_iso639> listLangTheso = getLanguagesOfThesaurus(ds, idThesaurus);
NodeThesaurus nodeThesaurus = new NodeThesaurus();
ArrayList<Thesaurus> thesaurusTraductionsList = new ArrayList<>();
for (int i = 0; i < listLangTheso.size(); i++) {
Thesaurus thesaurus = getThisThesaurus(ds, idThesaurus, listLangTheso.get(i).getId_iso639_1());
if (thesaurus != null) {
thesaurusTraductionsList.add(thesaurus);
}
}
nodeThesaurus.setIdThesaurus(idThesaurus);
nodeThesaurus.setListThesaurusTraduction(thesaurusTraductionsList);
return nodeThesaurus;
}
use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.
the class ThesaurusHelper method getThisThesaurus.
/**
* Permet de retourner un thésaurus par identifiant 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 idThesaurus
* @param idLang
* @return Objet Class Thesaurus
*/
public Thesaurus getThisThesaurus(HikariDataSource ds, String idThesaurus, String idLang) {
idLang = idLang.trim();
Connection conn;
Statement stmt;
ResultSet resultSet;
Thesaurus thesaurus = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select * from thesaurus_label where id_thesaurus = '" + idThesaurus + "' and lang = '" + idLang + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet.next()) {
if (resultSet.getString("lang") != null) {
thesaurus = new Thesaurus();
thesaurus.setId_thesaurus(idThesaurus);
thesaurus.setContributor(resultSet.getString("contributor"));
thesaurus.setCoverage(resultSet.getString("coverage"));
thesaurus.setCreator(resultSet.getString("creator"));
thesaurus.setCreated(resultSet.getDate("created"));
thesaurus.setModified(resultSet.getDate("modified"));
thesaurus.setDescription(resultSet.getString("description"));
thesaurus.setFormat(resultSet.getString("format"));
thesaurus.setLanguage(resultSet.getString("lang"));
thesaurus.setPublisher(resultSet.getString("publisher"));
thesaurus.setRelation(resultSet.getString("relation"));
thesaurus.setRights(resultSet.getString("rights"));
thesaurus.setSource(resultSet.getString("source"));
thesaurus.setSubject(resultSet.getString("subject"));
thesaurus.setTitle(resultSet.getString("title"));
thesaurus.setType(resultSet.getString("type"));
}
}
resultSet.close();
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting This Thesaurus : " + idThesaurus, sqle);
}
return thesaurus;
}
use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.
the class WriteFileSKOS method writeThesaurus.
public boolean writeThesaurus(NodeThesaurus nodeThesaurus) {
// Ecriture de la balise de declaration du thesaurus
String xml = " <skos:ConceptScheme rdf:about=\"" + URI + "?idt=" + nodeThesaurus.getIdThesaurus() + "\">\n";
// balises DublinCore pour le libellé du thésaurus
for (Thesaurus listThesaurusTraduction : nodeThesaurus.getListThesaurusTraduction()) {
if (!listThesaurusTraduction.getTitle().trim().isEmpty()) {
xml += " <skos:prefLabel xml:lang=";
xml += "\"" + listThesaurusTraduction.getLanguage() + "\">";
xml += listThesaurusTraduction.getTitle();
xml += "</skos:prefLabel>";
xml += "\n";
}
}
skosBuff.append(xml);
return true;
}
use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.
the class AccessThesaurusBean method addVisibility.
/**
* fonction addVisbility
* #JM
* fonction pour update ou insert d'une valeur dans visibility dans la table thesaurus via la classe accessThesaurusHelper
*/
public void addVisibility() {
boolean visible = this.accessThesaurus.isVisibility();
String id = theso.getEditTheso().getId_thesaurus();
AccessThesaurusHelper ath = new AccessThesaurusHelper();
int ret = ath.insertVisibility(this.connect.getPoolConnexion(), visible, id);
System.out.println("valeur retour insertVibility =" + ret);
theso.setEditTheso(new Thesaurus());
}
Aggregations