use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class GroupHelper method getListRootConceptGroup.
/**
* permet de retournner la liste des domaines de premier niveau (MT, G, C, T
* )
*
* @param ds
* @param idThesaurus
* @param idLang
* @return
*/
public ArrayList<NodeGroup> getListRootConceptGroup(HikariDataSource ds, String idThesaurus, String idLang) {
ArrayList<NodeGroup> nodeConceptGroupList;
ArrayList tabIdConceptGroup = getListIdOfRootGroup(ds, idThesaurus);
nodeConceptGroupList = new ArrayList<>();
for (Object tabIdGroup1 : tabIdConceptGroup) {
NodeGroup nodeConceptGroup;
nodeConceptGroup = getThisConceptGroup(ds, tabIdGroup1.toString(), idThesaurus, idLang);
if (nodeConceptGroup == null) {
return null;
}
nodeConceptGroupList.add(nodeConceptGroup);
}
return nodeConceptGroupList;
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class GroupHelper method getGroupHistoriqueFromDate.
/**
* Cette fonction permet de récupérer l'historique d'un groupe à une date
* précise
*
* @param ds
* @param idConcept
* @param idThesaurus
* @param date
* @return
*/
public ArrayList<NodeGroup> getGroupHistoriqueFromDate(HikariDataSource ds, String idConcept, String idThesaurus, Date date) {
Connection conn;
Statement stmt;
ArrayList<NodeGroup> nodeGroupList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select idgroup, id_ark, idtypecode, idparentgroup, notation, modified, username from concept_group_historique, users " + "where idconcept = '" + idConcept + "'" + " and idthesaurus = '" + idThesaurus + "'" + " and concept_group_historique.id_user=users.id_user" + " and modified <= '" + date.toString() + "' order by modified DESC";
ResultSet resultSet = stmt.executeQuery(query);
if (resultSet != null) {
nodeGroupList = new ArrayList<>();
while (resultSet.next()) {
NodeGroup nodeGroup = new NodeGroup();
nodeGroup.setIdUser(resultSet.getString("username"));
nodeGroup.setModified(resultSet.getDate("modified"));
nodeGroup.getConceptGroup().setId(resultSet.getInt("idgroup"));
nodeGroup.getConceptGroup().setIdARk(resultSet.getString("id_ark"));
nodeGroup.getConceptGroup().setIdthesaurus(idThesaurus);
nodeGroup.getConceptGroup().setIdtypecode(resultSet.getString("idtypecode"));
nodeGroup.getConceptGroup().setIdparentgroup(resultSet.getString("idparentgroup"));
nodeGroup.getConceptGroup().setNotation(resultSet.getString("notation"));
nodeGroup.getConceptGroup().setIdconcept(resultSet.getString("idconcept"));
nodeGroupList.add(nodeGroup);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting date historique group of concept : " + idConcept, sqle);
}
return nodeGroupList;
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class GroupHelper method getListGroupOfConcept.
/**
* Permet de retourner la liste des Groupes pour un Concept et un thésaurus
* donné
*
* @param ds le pool de connexion
* @param idThesaurus
* @param idConcept
* @param idLang
* @return Objet Class ArrayList NodeGroup
*/
public ArrayList<NodeGroup> getListGroupOfConcept(HikariDataSource ds, String idThesaurus, String idConcept, String idLang) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeGroup> nodeGroups = new ArrayList<>();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
/*String query = "select id_group from concept where id_thesaurus = '" + idThesaurus + "'"
+ " and id_concept = '" + idConcept + "'";*/
String query = "select idgroup from concept_group_concept where idthesaurus = '" + idThesaurus + "'" + " and idconcept = '" + idConcept + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
while (resultSet.next()) {
NodeGroup nodeGroup = getThisConceptGroup(ds, resultSet.getString("idgroup"), idThesaurus, idLang);
if (nodeGroup != null)
nodeGroups.add(nodeGroup);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting List Id or Groups of Concept : " + idConcept, sqle);
}
return nodeGroups;
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class GroupHelper method getGroupHistoriqueAll.
/**
* Cette fonction permet de récupérer l'historique d'un groupe
*
* @param ds
* @param idConcept
* @param idThesaurus
* @return
*/
public ArrayList<NodeGroup> getGroupHistoriqueAll(HikariDataSource ds, String idConcept, String idThesaurus) {
Connection conn;
Statement stmt;
ArrayList<NodeGroup> nodeGroupList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select idgroup, id_ark, idtypecode, idparentgroup, notation, modified, username from concept_group_historique, users " + "where idconcept = '" + idConcept + "'" + " and idthesaurus = '" + idThesaurus + "'" + " and concept_group_historique.id_user=users.id_user" + " order by modified DESC";
ResultSet resultSet = stmt.executeQuery(query);
if (resultSet != null) {
nodeGroupList = new ArrayList<>();
while (resultSet.next()) {
NodeGroup nodeGroup = new NodeGroup();
nodeGroup.setIdUser(resultSet.getString("username"));
nodeGroup.setModified(resultSet.getDate("modified"));
nodeGroup.getConceptGroup().setId(resultSet.getInt("idgroup"));
nodeGroup.getConceptGroup().setIdARk(resultSet.getString("id_ark"));
nodeGroup.getConceptGroup().setIdthesaurus(idThesaurus);
nodeGroup.getConceptGroup().setIdtypecode(resultSet.getString("idtypecode"));
nodeGroup.getConceptGroup().setIdparentgroup(resultSet.getString("idparentgroup"));
nodeGroup.getConceptGroup().setNotation(resultSet.getString("notation"));
nodeGroup.getConceptGroup().setIdconcept(resultSet.getString("idconcept"));
nodeGroupList.add(nodeGroup);
}
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting All historique group of concept : " + idConcept, sqle);
}
return nodeGroupList;
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup 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;
}
Aggregations