19 package org.sleuthkit.autopsy.centralrepository.contentviewer;
33 class OtherOccurrenceNodeInstanceData
implements OtherOccurrenceNodeData {
37 private static final String FILE_TYPE_STR =
"Files";
38 private static final String CSV_ITEM_SEPARATOR =
"\",\"";
40 private final String caseName;
41 private String deviceID;
42 private String dataSourceName;
43 private final String filePath;
44 private final String typeStr;
45 private final String value;
46 private TskData.FileKnown known;
47 private String comment;
49 private AbstractFile originalAbstractFile = null;
50 private CorrelationAttributeInstance originalCorrelationInstance = null;
59 OtherOccurrenceNodeInstanceData(CorrelationAttributeInstance instance, CorrelationAttributeInstance.Type type, String value) {
60 caseName = instance.getCorrelationCase().getDisplayName();
61 deviceID = instance.getCorrelationDataSource().getDeviceID();
62 dataSourceName = instance.getCorrelationDataSource().getName();
63 filePath = instance.getFilePath();
64 this.typeStr = type.getDisplayName();
66 known = instance.getKnownStatus();
67 comment = instance.getComment();
69 originalCorrelationInstance = instance;
80 OtherOccurrenceNodeInstanceData(AbstractFile newFile, Case autopsyCase)
throws CentralRepoException {
81 caseName = autopsyCase.getDisplayName();
83 DataSource dataSource = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId());
84 deviceID = dataSource.getDeviceId();
85 dataSourceName = dataSource.getName();
86 }
catch (TskDataException | TskCoreException ex) {
87 throw new CentralRepoException(
"Error loading data source for abstract file ID " + newFile.getId(), ex);
90 filePath = newFile.getParentPath() + newFile.getName();
91 typeStr = FILE_TYPE_STR;
92 value = newFile.getMd5Hash();
93 known = newFile.getKnown();
96 originalAbstractFile = newFile;
104 boolean isFileType() {
105 return FILE_TYPE_STR.equals(typeStr);
113 void updateKnown(TskData.FileKnown newKnownStatus) {
114 known = newKnownStatus;
122 void updateComment(String newComment) {
123 comment = newComment;
132 boolean isCentralRepoNode() {
133 return (originalCorrelationInstance != null);
141 String getCaseName() {
150 String getDeviceID() {
159 String getDataSourceName() {
160 return dataSourceName;
168 String getFilePath() {
195 TskData.FileKnown getKnown() {
204 String getComment() {
214 AbstractFile getAbstractFile() throws CentralRepoException {
215 if (originalAbstractFile == null) {
216 throw new CentralRepoException(
"AbstractFile is null");
218 return originalAbstractFile;
229 CorrelationAttributeInstance getCorrelationAttributeInstance() throws CentralRepoException {
230 if (originalCorrelationInstance == null) {
231 throw new CentralRepoException(
"CorrelationAttributeInstance is null");
233 return originalCorrelationInstance;
242 static String getCsvItemSeparator() {
243 return CSV_ITEM_SEPARATOR;
252 String toCsvString() {
253 StringBuilder line =
new StringBuilder(
"\"");
254 line.append(getCaseName()).append(CSV_ITEM_SEPARATOR)
255 .append(getDataSourceName()).append(CSV_ITEM_SEPARATOR)
256 .append(getType()).append(CSV_ITEM_SEPARATOR)
257 .append(getValue()).append(CSV_ITEM_SEPARATOR)
258 .append(getKnown().toString()).append(CSV_ITEM_SEPARATOR)
259 .append(getFilePath()).append(CSV_ITEM_SEPARATOR)
260 .append(getComment()).append(
'"')
261 .append(System.getProperty(
"line.separator"));
262 return line.toString();