19 package org.sleuthkit.autopsy.centralrepository.contentviewer;
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 import java.util.List;
25 import java.util.logging.Level;
26 import javax.swing.table.AbstractTableModel;
27 import org.openide.util.NbBundle.Messages;
28 import org.apache.commons.io.FilenameUtils;
42 private final List<String>
nodeKeys =
new ArrayList<>();
43 private final Map<String, List<OtherOccurrenceNodeData>>
nodeMap =
new HashMap<>();
59 return nodeKeys.size();
62 @Messages({
"OtherOccurrencesFilesTableModel.fileName=File Name",
63 "OtherOccurrencesFilesTableModel.noData=No Data."})
66 return Bundle.OtherOccurrencesFilesTableModel_fileName();
72 if (nodeMap.isEmpty() || nodeKeys.isEmpty() || rowIdx < 0
73 || rowIdx >= nodeKeys.size() || nodeKeys.get(rowIdx) == null
74 || nodeMap.get(nodeKeys.get(rowIdx)) == null
75 || nodeMap.get(nodeKeys.get(rowIdx)).isEmpty()) {
76 return Bundle.OtherOccurrencesFilesTableModel_noData();
78 return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).
get(0)).getFilePath());
90 List<OtherOccurrenceNodeData> getListOfNodesForFile(
int rowIdx) {
92 if (nodeMap.isEmpty() || nodeKeys.isEmpty() || rowIdx < 0
93 || rowIdx >= nodeKeys.size() || nodeKeys.get(rowIdx) == null
94 || nodeMap.get(nodeKeys.get(rowIdx)) == null) {
95 return new ArrayList<>();
97 return nodeMap.get(nodeKeys.get(rowIdx));
110 void addNodeData(OtherOccurrenceNodeData newNodeData) {
111 String newNodeKey =
createNodeKey((OtherOccurrenceNodeInstanceData) newNodeData);
112 List<OtherOccurrenceNodeData> nodeList = nodeMap.get(newNodeKey);
113 if (nodeList == null) {
114 nodeKeys.add(newNodeKey);
115 nodeList =
new ArrayList<>();
117 nodeList.add(newNodeData);
118 nodeMap.put(newNodeKey, nodeList);
119 fireTableDataChanged();
125 caseUUID = nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID();
132 logger.log(Level.WARNING,
"Unable to get current case", ex);
136 return nodeData.getCaseName() + nodeData.getDataSourceName() + nodeData.getDeviceID() + nodeData.getFilePath() + caseUUID;
145 fireTableDataChanged();
String getColumnName(int colIdx)
Object getValueAt(int rowIdx, int colIdx)
final Map< String, List< OtherOccurrenceNodeData > > nodeMap
Class< String > getColumnClass(int colIdx)
static final Logger logger
static final long serialVersionUID
String createNodeKey(OtherOccurrenceNodeInstanceData nodeData)
synchronized static Logger getLogger(String name)
final List< String > nodeKeys
static Case getCurrentCaseThrows()