20 package org.sleuthkit.autopsy.commonpropertiessearch;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.Collections;
25 import java.util.HashMap;
26 import java.util.HashSet;
27 import java.util.List;
30 import java.util.stream.Collectors;
41 private final Map<String, Integer>
fileNames =
new HashMap<>();
45 this.fileInstances =
new ArrayList<>();
57 String getTokenFileName() {
58 String tokenFileName = null;
60 for (String key : fileNames.keySet()){
61 if (fileNames.get(key) > maxValue){
62 maxValue = fileNames.get(key);
75 return this.fileInstances.stream().map(AbstractCommonAttributeInstance::getCaseName).collect(Collectors.joining(
", "));
84 Set<String> sources =
new HashSet<>();
86 sources.add(data.getDataSource());
98 int getNumberOfDataSourcesInCurrentCase() {
99 Set<Long> dataSourceIds =
new HashSet<>();
101 AbstractFile file = data.getAbstractFile();
103 dataSourceIds.add(file.getDataSourceObjectId());
106 return dataSourceIds.size();
109 void addInstance(AbstractCommonAttributeInstance metadata) {
110 if (metadata.getAbstractFile() != null) {
111 Integer currentValue = fileNames.get(metadata.getAbstractFile().getName());
112 currentValue = currentValue == null ? 1 : currentValue+1;
113 fileNames.put(metadata.getAbstractFile().getName(), currentValue);
115 this.fileInstances.add(metadata);
119 return Collections.unmodifiableCollection(this.fileInstances);
129 return this.fileInstances.size();
Collection< AbstractCommonAttributeInstance > getInstances()
Set< String > getDataSources()
final List< AbstractCommonAttributeInstance > fileInstances
final Map< String, Integer > fileNames