use of mom.trd.opentheso.bdd.helper.nodes.NodeImage in project opentheso by miledrousset.
the class ImagesHelper method getImages.
/**
* Cette fonction permet d'ajouter une définition note à un Terme
* à la table Term, en paramètre un objet Classe Term
*
* @param ds
* @param idConcept
* @param idThesausus
* @return
*/
public ArrayList<NodeImage> getImages(HikariDataSource ds, String idConcept, String idThesausus) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeImage> nodeImageList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select * from images where" + " id_concept = '" + idConcept + "'" + " and id_thesaurus = '" + idThesausus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeImageList = new ArrayList<>();
while (resultSet.next()) {
NodeImage nodeImage = new NodeImage();
nodeImage.setIdConcept(resultSet.getString("id_concept"));
nodeImage.setIdThesaurus(resultSet.getString("id_thesaurus"));
nodeImage.setImageName(resultSet.getString("image_name"));
nodeImage.setCopyRight(resultSet.getString("image_copyright"));
nodeImage.setUri(resultSet.getString("external_uri"));
nodeImageList.add(nodeImage);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while adding image of Concept : " + idConcept, sqle);
}
return nodeImageList;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeImage in project opentheso by miledrousset.
the class ExternalImagesHelper method getExternalImages.
/**
* Permet de récupérer les URI des images distantes qui sont liées au concept
*
* @param ds
* @param idConcept
* @param idThesausus
* @return
*/
public ArrayList<NodeImage> getExternalImages(HikariDataSource ds, String idConcept, String idThesausus) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeImage> nodeImageList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select * from external_images where" + " id_concept = '" + idConcept + "'" + " and id_thesaurus = '" + idThesausus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeImageList = new ArrayList<>();
while (resultSet.next()) {
NodeImage nodeImage = new NodeImage();
nodeImage.setIdConcept(resultSet.getString("id_concept"));
nodeImage.setIdThesaurus(resultSet.getString("id_thesaurus"));
nodeImage.setImageName(resultSet.getString("image_name"));
nodeImage.setCopyRight(resultSet.getString("image_copyright"));
nodeImage.setUri(resultSet.getString("external_uri"));
nodeImageList.add(nodeImage);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting image of Concept : " + idConcept, sqle);
}
return nodeImageList;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeImage in project opentheso by miledrousset.
the class ImagesHelper method getImage.
/**
* Cette fonction permet d'ajouter une définition note à un Terme
* à la table Term, en paramètre un objet Classe Term
*
* @param ds
* @param idConcept
* @param idThesausus
* @return
*/
public ArrayList<NodeImage> getImage(HikariDataSource ds, String idConcept, String idThesausus, int idUser) {
Connection conn;
Statement stmt;
boolean status = false;
ResultSet resultSet;
ArrayList<NodeImage> nodeImageList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select * from images where" + " id_concept = '" + idConcept + "'" + " and id_thesaurus = '" + idThesausus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeImageList = new ArrayList<NodeImage>();
while (resultSet.next()) {
NodeImage nodeImage = new NodeImage();
nodeImage.setIdConcept(resultSet.getString("id_concept"));
nodeImage.setIdThesaurus(resultSet.getString("id_thesaurus"));
nodeImage.setImageName(resultSet.getString("image_name"));
nodeImage.setCopyRight(resultSet.getString("image_copyright"));
nodeImageList.add(nodeImage);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while adding image of Concept : " + idConcept, sqle);
}
return nodeImageList;
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeImage in project opentheso by miledrousset.
the class ExternalResources method loadImages.
public void loadImages(String idTheso, String idConcept) {
images.clear();
ExternalImagesHelper imagesHelper = new ExternalImagesHelper();
nodeImages = imagesHelper.getExternalImages(connect.getPoolConnexion(), idConcept, idTheso);
if (nodeImages == null)
return;
for (NodeImage nodeImage : nodeImages) {
images.add(nodeImage.getUri());
}
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeImage in project opentheso by miledrousset.
the class ImagesHelper method getExternalImages.
/**
* Permet de récupérer les URI des images distantes qui sont liées au concept
*
* @param ds
* @param idConcept
* @param idThesausus
* @return
*/
public ArrayList<NodeImage> getExternalImages(HikariDataSource ds, String idConcept, String idThesausus) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeImage> nodeImageList = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select * from images where" + " id_concept = '" + idConcept + "'" + " and id_thesaurus = '" + idThesausus + "'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
nodeImageList = new ArrayList<>();
while (resultSet.next()) {
NodeImage nodeImage = new NodeImage();
nodeImage.setIdConcept(resultSet.getString("id_concept"));
nodeImage.setIdThesaurus(resultSet.getString("id_thesaurus"));
nodeImage.setImageName(resultSet.getString("image_name"));
nodeImage.setCopyRight(resultSet.getString("image_copyright"));
nodeImage.setUri(resultSet.getString("external_uri"));
nodeImageList.add(nodeImage);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting image of Concept : " + idConcept, sqle);
}
return nodeImageList;
}
Aggregations