Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
UniquePathKey.java
Go to the documentation of this file.
1 /*
2  * Central Repository
3  *
4  * Copyright 2017-2021 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.application;
20 
21 import java.util.Objects;
22 import java.util.logging.Level;
28 
33 public final class UniquePathKey {
34 
35  private static final Logger logger = Logger.getLogger(UniquePathKey.class.getName());
36  private final String dataSourceID;
37  private final String filePath;
38  private final String type;
39  private final String caseUUID;
40 
41  public UniquePathKey(NodeData nodeData) {
42  super();
43  dataSourceID = nodeData.getDeviceID();
44  if (nodeData.getFilePath() != null) {
45  filePath = nodeData.getFilePath().toLowerCase();
46  } else {
47  filePath = null;
48  }
49  type = nodeData.getType();
50  String tempCaseUUID;
51  try {
53  } catch (CentralRepoException ignored) {
54  //non central repo nodeData won't have a correlation case
55  try {
56  tempCaseUUID = Case.getCurrentCaseThrows().getName();
57  //place holder value will be used since correlation attribute was unavailble
58  } catch (NoCurrentCaseException ex) {
59  logger.log(Level.WARNING, "Unable to get current case", ex);
60  tempCaseUUID = OtherOccurrences.getPlaceholderUUID();
61  }
62  }
63  caseUUID = tempCaseUUID;
64  }
65 
66  @Override
67  public boolean equals(Object other) {
68  if (other instanceof UniquePathKey) {
69  UniquePathKey otherKey = (UniquePathKey) (other);
70  return (Objects.equals(otherKey.getDataSourceID(), this.getDataSourceID())
71  && Objects.equals(otherKey.getFilePath(), this.getFilePath())
72  && Objects.equals(otherKey.getType(), this.getType())
73  && Objects.equals(otherKey.getCaseUUID(), this.getCaseUUID()));
74  }
75  return false;
76  }
77 
78  @Override
79  public int hashCode() {
80  return Objects.hash(getDataSourceID(), getFilePath(), getType(), getCaseUUID());
81  }
82 
88  String getType() {
89  return type;
90  }
91 
97  String getFilePath() {
98  return filePath;
99  }
100 
106  String getDataSourceID() {
107  return dataSourceID;
108  }
109 
115  String getCaseUUID() {
116  return caseUUID;
117  }
118 }
CorrelationAttributeInstance getCorrelationAttributeInstance()
Definition: NodeData.java:229
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2021 Basis Technology. Generated on: Fri Aug 6 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.