19package org.sleuthkit.autopsy.centralrepository.contentviewer;
21import org.sleuthkit.autopsy.centralrepository.application.NodeData;
22import java.util.LinkedHashSet;
23import java.util.Objects;
25import java.util.logging.Level;
26import javax.swing.table.AbstractTableModel;
27import org.openide.util.NbBundle;
28import org.sleuthkit.autopsy.casemodule.Case;
29import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
30import org.sleuthkit.autopsy.centralrepository.application.OtherOccurrences;
31import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
32import org.sleuthkit.autopsy.coreutils.Logger;
38final class OtherOccurrencesDataSourcesTableModel
extends AbstractTableModel {
40 private static final long serialVersionUID = 1L;
41 private static final Logger logger = Logger.getLogger(OtherOccurrencesDataSourcesTableModel.class.getName());
42 private final Set<DataSourceColumnItem> dataSourceSet =
new LinkedHashSet<>();
47 OtherOccurrencesDataSourcesTableModel() {
52 public int getColumnCount() {
57 public int getRowCount() {
58 return dataSourceSet.size();
61 @NbBundle.Messages({
"OtherOccurrencesDataSourcesTableModel.dataSourceName=Data Source Name",
62 "OtherOccurrencesDataSourcesTableModel.noData=No Data."})
64 public String getColumnName(
int colIdx) {
65 return Bundle.OtherOccurrencesDataSourcesTableModel_dataSourceName();
69 public Object getValueAt(
int rowIdx,
int colIdx) {
71 if (dataSourceSet.isEmpty() || rowIdx < 0
72 || rowIdx >= dataSourceSet.size()
74 return Bundle.OtherOccurrencesDataSourcesTableModel_noData();
87 String getDeviceIdForRow(
int rowIdx) {
89 if (dataSourceSet.isEmpty() || rowIdx < 0
90 || rowIdx >= dataSourceSet.size()
106 String getCaseUUIDForRow(
int rowIdx) {
108 if (dataSourceSet.isEmpty() || rowIdx < 0
109 || rowIdx >= dataSourceSet.size()
124 String getCaseNameForRow(
int rowIdx) {
126 if (dataSourceSet.isEmpty() || rowIdx < 0
127 || rowIdx >= dataSourceSet.size()
135 public Class<String> getColumnClass(
int colIdx) {
144 void addNodeData(NodeData newNodeData) {
147 caseUUID = newNodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID();
148 }
catch (CentralRepoException ignored) {
151 caseUUID = Case.getCurrentCaseThrows().getName();
153 }
catch (NoCurrentCaseException ex) {
154 logger.log(Level.WARNING,
"Unable to get current case", ex);
155 caseUUID = OtherOccurrences.getPlaceholderUUID();
158 dataSourceSet.add(
new DataSourceColumnItem(newNodeData.getCaseName(), newNodeData.getDeviceID(), newNodeData.getDataSourceName(), caseUUID));
159 fireTableDataChanged();
166 dataSourceSet.clear();
167 fireTableDataChanged();
final String dataSourceName
String getDataSourceName()
boolean equals(Object other)
DataSourceColumnItem(String caseName, String deviceId, String dataSourceName, String caseUUID)