Autopsy  4.19.3
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;
27 
32 public final class UniquePathKey {
33 
34  private static final Logger logger = Logger.getLogger(UniquePathKey.class.getName());
35  private final String dataSourceID;
36  private final String filePath;
37  private final String type;
38  private final String caseUUID;
39 
40  public UniquePathKey(NodeData nodeData) {
41  super();
42  dataSourceID = nodeData.getDeviceID();
43  if (nodeData.getFilePath() != null) {
44  filePath = nodeData.getFilePath().toLowerCase();
45  } else {
46  filePath = null;
47  }
48  type = nodeData.getType();
49  String tempCaseUUID;
50  try {
52  } catch (CentralRepoException ignored) {
53  //non central repo nodeData won't have a correlation case
54  try {
55  tempCaseUUID = Case.getCurrentCaseThrows().getName();
56  //place holder value will be used since correlation attribute was unavailble
57  } catch (NoCurrentCaseException ex) {
58  logger.log(Level.WARNING, "Unable to get current case", ex);
59  tempCaseUUID = OtherOccurrences.getPlaceholderUUID();
60  }
61  }
62  caseUUID = tempCaseUUID;
63  }
64 
65  @Override
66  public boolean equals(Object other) {
67  if (other instanceof UniquePathKey) {
68  UniquePathKey otherKey = (UniquePathKey) (other);
69  return (Objects.equals(otherKey.getDataSourceID(), this.getDataSourceID())
70  && Objects.equals(otherKey.getFilePath(), this.getFilePath())
71  && Objects.equals(otherKey.getType(), this.getType())
72  && Objects.equals(otherKey.getCaseUUID(), this.getCaseUUID()));
73  }
74  return false;
75  }
76 
77  @Override
78  public int hashCode() {
79  return Objects.hash(getDataSourceID(), getFilePath(), getType(), getCaseUUID());
80  }
81 
87  String getType() {
88  return type;
89  }
90 
96  String getFilePath() {
97  return filePath;
98  }
99 
105  String getDataSourceID() {
106  return dataSourceID;
107  }
108 
114  String getCaseUUID() {
115  return caseUUID;
116  }
117 }
CorrelationAttributeInstance getCorrelationAttributeInstance()
Definition: NodeData.java:219
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Oct 4 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.