diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java index 5b81dc6b3b..6a4a138cfb 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepository.java @@ -806,15 +806,6 @@ public interface CentralRepository { public void processSelectClause(String selectClause, InstanceTableCallback instanceTableCallback) throws CentralRepoException; - /** - * Returns list of all correlation types. - * - * @return list of Correlation types - * @throws CentralRepoException - */ - List getCorrelationTypes() throws CentralRepoException; - - /** * Get account type by type name. * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java index 5f8f00850b..256e5407c9 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/RdbmsCentralRepo.java @@ -3134,27 +3134,12 @@ abstract class RdbmsCentralRepo implements CentralRepository { @Override public List getDefinedCorrelationTypes() throws CentralRepoException { - Connection conn = connect(); - List aTypes = new ArrayList<>(); - PreparedStatement preparedStatement = null; - ResultSet resultSet = null; - String sql = "SELECT * FROM correlation_types"; - - try { - preparedStatement = conn.prepareStatement(sql); - resultSet = preparedStatement.executeQuery(); - while (resultSet.next()) { - aTypes.add(getCorrelationTypeFromResultSet(resultSet)); + synchronized (typeCache) { + if (isCRTypeCacheInitialized == false) { + getCorrelationTypesFromCr(); } - return aTypes; - - } catch (SQLException ex) { - throw new CentralRepoException("Error getting all correlation types.", ex); // NON-NLS - } finally { - CentralRepoDbUtil.closeStatement(preparedStatement); - CentralRepoDbUtil.closeResultSet(resultSet); - CentralRepoDbUtil.closeConnection(conn); + return new ArrayList<>(typeCache.asMap().values()); } } @@ -3285,45 +3270,6 @@ abstract class RdbmsCentralRepo implements CentralRepository { } } - /** - * Returns a list of all correlation types. It uses the cache to build the - * list. If the cache is empty, it reads from the database and loads up the - * cache. - * - * @return List of correlation types. - * @throws CentralRepoException - */ - @Override - public List getCorrelationTypes() throws CentralRepoException { - - synchronized (typeCache) { - if (isCRTypeCacheInitialized == false) { - getCorrelationTypesFromCr(); - } - return new ArrayList<>(typeCache.asMap().values()); - } - } - - /** - * Gets a Correlation type with the specified name. - * - * @param correlationtypeName Correlation type name - * @return Correlation type matching the given name, null if none matches. - * - * @throws CentralRepoException - */ - public CorrelationAttributeInstance.Type getCorrelationTypeByName(String correlationtypeName) throws CentralRepoException { - List correlationTypesList = getCorrelationTypes(); - - CorrelationAttributeInstance.Type correlationType - = correlationTypesList.stream() - .filter(x -> correlationtypeName.equalsIgnoreCase(x.getDisplayName())) - .findAny() - .orElse(null); - - return null; - } - /** * Get the EamArtifact.Type that has the given Type.Id from the central repo diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java index e096638434..6b1fe1ab72 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCaseSearchResults.java @@ -123,7 +123,7 @@ final public class CommonAttributeCaseSearchResults { if (currentCaseDataSourceMap == null) { //there are no results return filteredCaseNameToDataSourcesTree; } - CorrelationAttributeInstance.Type attributeType = CentralRepository.getInstance().getCorrelationTypes() + CorrelationAttributeInstance.Type attributeType = CentralRepository.getInstance().getDefinedCorrelationTypes() .stream() .filter(filterType -> filterType.getId() == resultTypeId) .findFirst().get(); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java index 85923e53b6..80a65b2835 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributeCountSearchResults.java @@ -129,7 +129,7 @@ final public class CommonAttributeCountSearchResults { } CentralRepository eamDb = CentralRepository.getInstance(); - CorrelationAttributeInstance.Type attributeType = eamDb.getCorrelationTypes() + CorrelationAttributeInstance.Type attributeType = eamDb.getDefinedCorrelationTypes() .stream() .filter(filterType -> filterType.getId() == this.resultTypeId) .findFirst().get(); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java index 43d834e39d..5e7aa3adb4 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/CommonAttributePanel.java @@ -255,7 +255,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer filterByDocuments = interCasePanel.documentsCheckboxIsSelected(); } if (corType == null) { - corType = CentralRepository.getInstance().getCorrelationTypes().get(0); + corType = CentralRepository.getInstance().getDefinedCorrelationTypes().get(0); } if (caseId == InterCasePanel.NO_CASE_SELECTED) { builder = new AllInterCaseCommonAttributeSearcher(filterByMedia, filterByDocuments, corType, percentageThreshold); @@ -366,7 +366,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer filterByDocuments = interCasePanel.documentsCheckboxIsSelected(); } if (corType == null) { - corType = CentralRepository.getInstance().getCorrelationTypes().get(0); + corType = CentralRepository.getInstance().getDefinedCorrelationTypes().get(0); } if (caseId == InterCasePanel.NO_CASE_SELECTED) { builder = new AllInterCaseCommonAttributeSearcher(filterByMedia, filterByDocuments, corType, percentageThreshold); diff --git a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java index a2c1c01529..f36f8ab520 100644 --- a/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java +++ b/Core/src/org/sleuthkit/autopsy/commonpropertiessearch/InterCasePanel.java @@ -118,7 +118,7 @@ public final class InterCasePanel extends javax.swing.JPanel { void setupCorrelationTypeFilter() { this.correlationTypeFilters = new HashMap<>(); try { - List types = CentralRepository.getInstance().getCorrelationTypes(); + List types = CentralRepository.getInstance().getDefinedCorrelationTypes(); for (CorrelationAttributeInstance.Type type : types) { correlationTypeFilters.put(type.getDisplayName(), type); this.correlationTypeComboBox.addItem(type.getDisplayName()); diff --git a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java index 49617c9dfb..67e0366a9b 100755 --- a/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java +++ b/Core/src/org/sleuthkit/autopsy/communications/relationships/CorrelationCaseChildNodeFactory.java @@ -111,7 +111,7 @@ final class CorrelationCaseChildNodeFactory extends ChildFactory(); - List correcationTypeList = CentralRepository.getInstance().getCorrelationTypes(); + List correcationTypeList = CentralRepository.getInstance().getDefinedCorrelationTypes(); correcationTypeList.forEach((type) -> { correlationTypeMap.put(type.getId(), type); });