Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CorrelationDataSource.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2015-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.datamodel;
20 
21 import java.io.Serializable;
24 import org.sleuthkit.datamodel.Content;
25 import org.sleuthkit.datamodel.TskCoreException;
26 import org.sleuthkit.datamodel.TskDataException;
27 
33 public class CorrelationDataSource implements Serializable {
34 
35  private static final long serialVersionUID = 1L;
36 
37  private final int caseID; //the value in the id column of the case table in the central repo
38  private final int dataSourceID; //< Id in the central repo
39  private final String deviceID; //< Unique to its associated case (not necessarily globally unique)
40  private final String name;
41 
48  public CorrelationDataSource(int caseId, String deviceId, String name) {
49  this(caseId, -1, deviceId, name);
50  }
51 
52  CorrelationDataSource(int caseId,
53  int dataSourceId,
54  String deviceId,
55  String name) {
56  this.caseID = caseId;
57  this.dataSourceID = dataSourceId;
58  this.deviceID = deviceId;
59  this.name = name;
60  }
61 
74  public static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource) throws EamDbException {
75  Case curCase;
76  try {
77  curCase = Case.getOpenCase();
78  } catch (NoCurrentCaseException ex) {
79  throw new EamDbException("Autopsy case is closed");
80  }
81  String deviceId;
82  try {
83  deviceId = curCase.getSleuthkitCase().getDataSource(dataSource.getId()).getDeviceId();
84  } catch (TskDataException | TskCoreException ex) {
85  throw new EamDbException("Error getting data source info: " + ex.getMessage());
86  }
87  return new CorrelationDataSource(correlationCase.getID(), -1, deviceId, dataSource.getName());
88  }
89 
90  @Override
91  public String toString() {
92  StringBuilder str = new StringBuilder();
93  str.append("(");
94  str.append("ID=").append(Integer.toString(getID()));
95  str.append(",caseID=").append(Integer.toString(getCaseID()));
96  str.append(",deviceID=").append(getDeviceID());
97  str.append(",name=").append(getName());
98  str.append(")");
99  return str.toString();
100  }
101 
107  int getID() {
108  return dataSourceID;
109  }
110 
116  public String getDeviceID() {
117  return deviceID;
118  }
119 
125  public int getCaseID() {
126  return caseID;
127  }
128 
132  public String getName() {
133  return name;
134  }
135 }
static CorrelationDataSource fromTSKDataSource(CorrelationCase correlationCase, Content dataSource)

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.