Search in sources :

Example 1 with NodeImage

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

Example 2 with NodeImage

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

Example 3 with NodeImage

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

Example 4 with NodeImage

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());
    }
}
Also used : NodeImage(mom.trd.opentheso.bdd.helper.nodes.NodeImage) ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Example 5 with NodeImage

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

Aggregations

NodeImage (mom.trd.opentheso.bdd.helper.nodes.NodeImage)6 Connection (java.sql.Connection)4 ResultSet (java.sql.ResultSet)4 SQLException (java.sql.SQLException)4 Statement (java.sql.Statement)4 ExternalImagesHelper (mom.trd.opentheso.bdd.helper.ExternalImagesHelper)1 SelectedResource (mom.trd.opentheso.core.alignment.SelectedResource)1