Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CaseDBCommonAttributeInstanceNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
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.commonpropertiessearch;
20 
21 import java.util.Arrays;
22 import java.util.HashSet;
23 import java.util.Set;
24 import org.openide.nodes.Sheet;
25 import org.openide.util.NbBundle;
30 import org.sleuthkit.datamodel.AbstractFile;
31 
37 
38  private final String caseName;
39  private final String dataSource;
40  private final String value;
42 
54  public CaseDBCommonAttributeInstanceNode(AbstractFile fsContent, String caseName, String dataSource, String value, AbstractCommonAttributeInstance.NODE_TYPE nodeType) {
55  super(fsContent, false);
56  this.caseName = caseName;
57  this.dataSource = dataSource;
58  this.nodeType = nodeType;
59  this.value = value;
60  }
61 
62  @Override
63  public boolean isLeafTypeNode() {
64  //Not used atm - could maybe be leveraged for better use in Children objects
65  return true;
66  }
67 
68  @Override
69  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
70  return visitor.visit(this);
71  }
72 
73  public String getCase() {
74  return this.caseName;
75  }
76 
77  public String getDataSource() {
78  return this.dataSource;
79  }
80 
81  @Override
82  protected Sheet createSheet() {
83  Sheet sheet = super.createSheet();
84  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
85  Set<String> keepProps = new HashSet<>(Arrays.asList(
86  NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.nameColLbl"),
87  NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.score.name"),
88  NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.comment.name"),
89  NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.count.name"),
90  NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.mimeType")));
91 
92  for (Property<?> p : sheetSet.getProperties()) {
93  if (!keepProps.contains(p.getName())) {
94  sheetSet.remove(p.getName());
95  }
96  }
97  final String NO_DESCR = Bundle.CommonFilesSearchResultsViewerTable_noDescText();
98  //add different columns for complete information depending on how nodes are structured in results
100  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR, this.getContent().getParentPath()));
101  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR, this.getDataSource()));
102  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), NO_DESCR, caseName));
104  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_localPath(), Bundle.CommonFilesSearchResultsViewerTable_localPath(), NO_DESCR, this.getContent().getParentPath()));
105  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_valueColLbl(), Bundle.CommonFilesSearchResultsViewerTable_valueColLbl(), NO_DESCR, this.value));
106  }
107  return sheet;
108  }
109 }
CaseDBCommonAttributeInstanceNode(AbstractFile fsContent, String caseName, String dataSource, String value, AbstractCommonAttributeInstance.NODE_TYPE nodeType)

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