From ab83c9940c6dfd7d8312b994e900db02977d816f Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Sun, 17 Jun 2018 23:15:23 -0400 Subject: [PATCH] reduce API --- .../imagegallery/datamodel/DrawableDB.java | 83 ++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java index fa008fe3e9..a5092614a7 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java @@ -847,35 +847,35 @@ public final class DrawableDB { * * @throws TskCoreException */ - @Deprecated - public long countFiles() throws TskCoreException { - Statement statement = null; - ResultSet rs = null; - dbReadLock(); - try { - statement = con.createStatement(); - rs = statement.executeQuery("SELECT COUNT (*) FROM drawable_files"); //NON-NLS - return rs.getLong(1); - } catch (SQLException e) { - throw new TskCoreException("SQLException thrown when calling 'DrawableDB.countFiles(): ", e); - } finally { - if (rs != null) { - try { - rs.close(); - } catch (SQLException ex) { - LOGGER.log(Level.SEVERE, "Error closing result set after executing countFiles", ex); //NON-NLS - } - } - if (statement != null) { - try { - statement.close(); - } catch (SQLException ex) { - LOGGER.log(Level.SEVERE, "Error closing statement after executing countFiles", ex); //NON-NLS - } - } - dbReadUnlock(); - } - } +// @Deprecated +// public long countFiles() throws TskCoreException { +// Statement statement = null; +// ResultSet rs = null; +// dbReadLock(); +// try { +// statement = con.createStatement(); +// rs = statement.executeQuery("SELECT COUNT (*) FROM drawable_files"); //NON-NLS +// return rs.getLong(1); +// } catch (SQLException e) { +// throw new TskCoreException("SQLException thrown when calling 'DrawableDB.countFiles(): ", e); +// } finally { +// if (rs != null) { +// try { +// rs.close(); +// } catch (SQLException ex) { +// LOGGER.log(Level.SEVERE, "Error closing result set after executing countFiles", ex); //NON-NLS +// } +// } +// if (statement != null) { +// try { +// statement.close(); +// } catch (SQLException ex) { +// LOGGER.log(Level.SEVERE, "Error closing statement after executing countFiles", ex); //NON-NLS +// } +// } +// dbReadUnlock(); +// } +// } /** * @@ -952,7 +952,12 @@ public final class DrawableDB { return vals; } - public void insertGroup(final String value, DrawableAttribute groupBy) { + /** + * Insert new group into DB + * @param value Value of the group (unique to the type) + * @param groupBy Type of the grouping (CATEGORY, MAKE, etc.) + */ + private void insertGroup(final String value, DrawableAttribute groupBy) { dbWriteLock(); try { @@ -980,15 +985,15 @@ public final class DrawableDB { * @throws TskCoreException if unable to get a file from the currently open * {@link SleuthkitCase} */ - private DrawableFile getFileFromID(Long id, boolean analyzed) throws TskCoreException { - try { - AbstractFile f = tskCase.getAbstractFileById(id); - return DrawableFile.create(f, analyzed, isVideoFile(f)); - } catch (IllegalStateException ex) { - LOGGER.log(Level.SEVERE, "there is no case open; failed to load file with id: " + id, ex); //NON-NLS - return null; - } - } +// private DrawableFile getFileFromID(Long id, boolean analyzed) throws TskCoreException { +// try { +// AbstractFile f = tskCase.getAbstractFileById(id); +// return DrawableFile.create(f, analyzed, isVideoFile(f)); +// } catch (IllegalStateException ex) { +// LOGGER.log(Level.SEVERE, "there is no case open; failed to load file with id: " + id, ex); //NON-NLS +// return null; +// } +// } /** * @param id the obj_id of the file to return