Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CaseDBCommonAttributeInstance.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2018 Basis Technology Corp.
6  * Contact: carrier <at> sleuthkit <dot> org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.sleuthkit.autopsy.commonpropertiessearch;
21 
22 import java.util.Arrays;
23 import java.util.logging.Level;
29 import org.sleuthkit.datamodel.AbstractFile;
30 import org.sleuthkit.datamodel.SleuthkitCase;
31 import org.sleuthkit.datamodel.TskCoreException;
32 
38 
39  private static final Logger LOGGER = Logger.getLogger(CaseDBCommonAttributeInstance.class.getName());
40  private final String value;
41 
50  CaseDBCommonAttributeInstance(Long abstractFileReference, String dataSource, String caseName, String value) {
51  super(abstractFileReference, dataSource, caseName);
52  this.value = value;
53  }
54 
55  @Override
57  final CaseDBCommonAttributeInstanceNode intraCaseCommonAttributeInstanceNode = new CaseDBCommonAttributeInstanceNode(this.getAbstractFile(), this.getCaseName(), this.getDataSource(), this.value, NODE_TYPE.COUNT_NODE);
58  return Arrays.asList(intraCaseCommonAttributeInstanceNode).toArray(new DisplayableItemNode[1]);
59  }
60 
61  @Override
62  AbstractFile getAbstractFile() {
63 
64  Case currentCase;
65  try {
66  currentCase = Case.getCurrentCaseThrows();
67 
68  SleuthkitCase tskDb = currentCase.getSleuthkitCase();
69 
70  return this.abstractFile = tskDb.findAllFilesWhere(String.format("obj_id in (%s)", this.getAbstractFileObjectId())).get(0);
71 
72  } catch (TskCoreException | NoCurrentCaseException ex) {
73  LOGGER.log(Level.SEVERE, String.format("Unable to find AbstractFile for record with obj_id: %s. Node not created.", new Object[]{this.getAbstractFileObjectId()}), ex);
74  return null;
75  }
76  }
77 
78  @Override
80  //may be required at a later date
81  throw new UnsupportedOperationException("Not supported yet.");
82  }
83 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.