Autopsy  4.10.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
OtherOccurrenceNodeInstanceData.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2018 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.centralrepository.contentviewer;
20 
24 import org.sleuthkit.datamodel.AbstractFile;
25 import org.sleuthkit.datamodel.DataSource;
26 import org.sleuthkit.datamodel.TskCoreException;
27 import org.sleuthkit.datamodel.TskData;
28 import org.sleuthkit.datamodel.TskDataException;
29 
33 class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData {
34 
35  // For now hard code the string for the central repo files type, since
36  // getting it dynamically can fail.
37  private static final String FILE_TYPE_STR = "Files";
38 
39  private final String caseName;
40  private String deviceID;
41  private String dataSourceName;
42  private final String filePath;
43  private final String typeStr;
44  private final String value;
45  private TskData.FileKnown known;
46  private String comment;
47 
48  private AbstractFile originalAbstractFile = null;
49  private CorrelationAttributeInstance originalCorrelationInstance = null;
50 
57  OtherOccurrenceNodeInstanceData(CorrelationAttributeInstance instance, CorrelationAttributeInstance.Type type, String value) {
58  caseName = instance.getCorrelationCase().getDisplayName();
59  deviceID = instance.getCorrelationDataSource().getDeviceID();
60  dataSourceName = instance.getCorrelationDataSource().getName();
61  filePath = instance.getFilePath();
62  this.typeStr = type.getDisplayName();
63  this.value = value;
64  known = instance.getKnownStatus();
65  comment = instance.getComment();
66 
67  originalCorrelationInstance = instance;
68  }
69 
76  OtherOccurrenceNodeInstanceData(AbstractFile newFile, Case autopsyCase) throws EamDbException {
77  caseName = autopsyCase.getDisplayName();
78  try {
79  DataSource dataSource = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId());
80  deviceID = dataSource.getDeviceId();
81  dataSourceName = dataSource.getName();
82  } catch (TskDataException | TskCoreException ex) {
83  throw new EamDbException("Error loading data source for abstract file ID " + newFile.getId(), ex);
84  }
85 
86  filePath = newFile.getParentPath() + newFile.getName();
87  typeStr = FILE_TYPE_STR;
88  value = newFile.getMd5Hash();
89  known = newFile.getKnown();
90  comment = "";
91 
92  originalAbstractFile = newFile;
93  }
94 
99  boolean isFileType() {
100  return FILE_TYPE_STR.equals(typeStr);
101  }
102 
107  void updateKnown(TskData.FileKnown newKnownStatus) {
108  known = newKnownStatus;
109  }
110 
115  void updateComment(String newComment) {
116  comment = newComment;
117  }
118 
123  boolean isCentralRepoNode() {
124  return (originalCorrelationInstance != null);
125  }
126 
131  String getCaseName() {
132  return caseName;
133  }
134 
139  String getDeviceID() {
140  return deviceID;
141  }
142 
147  String getDataSourceName() {
148  return dataSourceName;
149  }
150 
155  String getFilePath() {
156  return filePath;
157  }
158 
163  String getType() {
164  return typeStr;
165  }
166 
171  String getValue() {
172  return value;
173  }
174 
179  TskData.FileKnown getKnown() {
180  return known;
181  }
182 
187  String getComment() {
188  return comment;
189  }
190 
196  AbstractFile getAbstractFile() throws EamDbException {
197  if (originalAbstractFile == null) {
198  throw new EamDbException("AbstractFile is null");
199  }
200  return originalAbstractFile;
201  }
202 
209  CorrelationAttributeInstance getCorrelationAttributeInstance() throws EamDbException {
210  if (originalCorrelationInstance == null) {
211  throw new EamDbException("CorrelationAttributeInstance is null");
212  }
213  return originalCorrelationInstance;
214  }
215 }

Copyright © 2012-2018 Basis Technology. Generated on: Fri Mar 22 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.