reduce API

This commit is contained in:
Brian Carrier 2018-06-17 23:15:23 -04:00
parent 0ec2af8619
commit ab83c9940c

View File

@ -847,35 +847,35 @@ public final class DrawableDB {
* *
* @throws TskCoreException * @throws TskCoreException
*/ */
@Deprecated // @Deprecated
public long countFiles() throws TskCoreException { // public long countFiles() throws TskCoreException {
Statement statement = null; // Statement statement = null;
ResultSet rs = null; // ResultSet rs = null;
dbReadLock(); // dbReadLock();
try { // try {
statement = con.createStatement(); // statement = con.createStatement();
rs = statement.executeQuery("SELECT COUNT (*) FROM drawable_files"); //NON-NLS // rs = statement.executeQuery("SELECT COUNT (*) FROM drawable_files"); //NON-NLS
return rs.getLong(1); // return rs.getLong(1);
} catch (SQLException e) { // } catch (SQLException e) {
throw new TskCoreException("SQLException thrown when calling 'DrawableDB.countFiles(): ", e); // throw new TskCoreException("SQLException thrown when calling 'DrawableDB.countFiles(): ", e);
} finally { // } finally {
if (rs != null) { // if (rs != null) {
try { // try {
rs.close(); // rs.close();
} catch (SQLException ex) { // } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Error closing result set after executing countFiles", ex); //NON-NLS // LOGGER.log(Level.SEVERE, "Error closing result set after executing countFiles", ex); //NON-NLS
} // }
} // }
if (statement != null) { // if (statement != null) {
try { // try {
statement.close(); // statement.close();
} catch (SQLException ex) { // } catch (SQLException ex) {
LOGGER.log(Level.SEVERE, "Error closing statement after executing countFiles", ex); //NON-NLS // LOGGER.log(Level.SEVERE, "Error closing statement after executing countFiles", ex); //NON-NLS
} // }
} // }
dbReadUnlock(); // dbReadUnlock();
} // }
} // }
/** /**
* *
@ -952,7 +952,12 @@ public final class DrawableDB {
return vals; 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(); dbWriteLock();
try { try {
@ -980,15 +985,15 @@ public final class DrawableDB {
* @throws TskCoreException if unable to get a file from the currently open * @throws TskCoreException if unable to get a file from the currently open
* {@link SleuthkitCase} * {@link SleuthkitCase}
*/ */
private DrawableFile getFileFromID(Long id, boolean analyzed) throws TskCoreException { // private DrawableFile getFileFromID(Long id, boolean analyzed) throws TskCoreException {
try { // try {
AbstractFile f = tskCase.getAbstractFileById(id); // AbstractFile f = tskCase.getAbstractFileById(id);
return DrawableFile.create(f, analyzed, isVideoFile(f)); // return DrawableFile.create(f, analyzed, isVideoFile(f));
} catch (IllegalStateException ex) { // } catch (IllegalStateException ex) {
LOGGER.log(Level.SEVERE, "there is no case open; failed to load file with id: " + id, ex); //NON-NLS // LOGGER.log(Level.SEVERE, "there is no case open; failed to load file with id: " + id, ex); //NON-NLS
return null; // return null;
} // }
} // }
/** /**
* @param id the obj_id of the file to return * @param id the obj_id of the file to return