7608 fix discovery use case and add comment

This commit is contained in:
William Schaefer 2021-05-13 17:34:54 -04:00
parent 1042f2844f
commit abfbc3106e

View File

@ -381,11 +381,12 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
Set<String> dataSources = new HashSet<>(); Set<String> dataSources = new HashSet<>();
if (CentralRepository.isEnabled()) { if (CentralRepository.isEnabled()) {
try { try {
correlationAttributes.addAll(CentralRepository.getInstance().getArtifactInstancesByTypeValue(aType, value)); List<CorrelationAttributeInstance> instances;
instances = CentralRepository.getInstance().getArtifactInstancesByTypeValue(aType, value);
HashMap<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap = new HashMap<>(); HashMap<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap = new HashMap<>();
String caseUUID = Case.getCurrentCase().getName(); String caseUUID = Case.getCurrentCase().getName();
// get the attributes we can correlate on // get the attributes we can correlate on
for (CorrelationAttributeInstance artifactInstance : correlationAttributes) { for (CorrelationAttributeInstance artifactInstance : instances) {
// Only add the attribute if it isn't the object the user selected. // Only add the attribute if it isn't the object the user selected.
// We consider it to be a different object if at least one of the following is true: // We consider it to be a different object if at least one of the following is true:
@ -397,6 +398,8 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
&& (!StringUtils.isBlank(dataSourceName) && artifactInstance.getCorrelationDataSource().getName().equals(dataSourceName)) && (!StringUtils.isBlank(dataSourceName) && artifactInstance.getCorrelationDataSource().getName().equals(dataSourceName))
&& (!StringUtils.isBlank(deviceId) && artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId)) && (!StringUtils.isBlank(deviceId) && artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId))
&& (file != null && artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName()))) { && (file != null && artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName()))) {
//because we are only correlating on one type we can add that only when everything is the same
correlationAttributes.add(artifactInstance);
continue; continue;
} }
OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(artifactInstance, aType, value); OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(artifactInstance, aType, value);