Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CentralRepoCommonAttributeInstanceNode.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.io.File;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.List;
26 import javax.swing.Action;
27 import org.openide.nodes.Children;
28 import org.openide.nodes.Sheet;
29 import org.openide.util.NbBundle;
30 import org.openide.util.lookup.Lookups;
36 
47 
50 
52  super(Children.LEAF, Lookups.fixed(content));
53  this.crFile = content;
54  this.setDisplayName(new File(this.crFile.getFilePath()).getName());
55  this.nodeType = nodeType;
56  }
57 
59  return this.crFile;
60  }
61 
62  @Override
63  public Action[] getActions(boolean context) {
64  List<Action> actionsList = new ArrayList<>();
65 
66  actionsList.addAll(Arrays.asList(super.getActions(true)));
67 
68  return actionsList.toArray(new Action[actionsList.size()]);
69  }
70 
71  @Override
72  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
73  return visitor.visit(this);
74  }
75 
76  @Override
77  public boolean isLeafTypeNode() {
78  return true;
79  }
80 
81  @Override
82  public String getItemType() {
83  //objects of type FileNode will co-occur in the treetable with objects
84  // of this type and they will need to provide the same key
85  return CaseDBCommonAttributeInstanceNode.class.getName();
86  }
87 
88  @Override
89  protected Sheet createSheet() {
90  Sheet sheet = new Sheet();
91  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
92 
93  if (sheetSet == null) {
94  sheetSet = Sheet.createPropertiesSet();
95  sheet.put(sheetSet);
96  }
97 
99 
100  final String fullPath = centralRepoFile.getFilePath();
101  final File file = new File(fullPath);
102 
103  final String caseName = centralRepoFile.getCorrelationCase().getDisplayName();
104 
105  String name = file.getName();
106  if (name == null) {
107  name = "";
108  }
109  String parent = file.getParent();
110  if (parent == null) {
111  parent = "";
112  }
113  final String value = centralRepoFile.getCorrelationValue();
114 
115  final String dataSourceName = centralRepoFile.getCorrelationDataSource().getName();
116 
117  final String NO_DESCR = Bundle.CommonFilesSearchResultsViewerTable_noDescText();
118 
119  sheetSet.put(new NodeProperty<>(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.nameColLbl"), NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.nameColLbl"), NO_DESCR, name));
120  //add different columns for complete information depending on how nodes are structured in results
122  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR, parent));
123  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR, dataSourceName));
124  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), NO_DESCR, caseName));
126  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_localPath(), Bundle.CommonFilesSearchResultsViewerTable_localPath(), NO_DESCR, parent));
127  sheetSet.put(new NodeProperty<>(Bundle.CommonFilesSearchResultsViewerTable_valueColLbl(), Bundle.CommonFilesSearchResultsViewerTable_valueColLbl(), NO_DESCR, value));
128  }
129  sheetSet.put(new NodeProperty<>(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.mimeType"), NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.mimeType"), NO_DESCR, ""));
130 
131  return sheet;
132  }
133 }

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.