Autopsy  4.8.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
LocalDirectoryNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-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.datamodel;
20 
21 import java.util.LinkedHashMap;
22 import java.util.List;
23 import java.util.Map;
24 import org.openide.nodes.Sheet;
25 import org.openide.util.NbBundle;
29 import org.sleuthkit.datamodel.ContentTag;
30 import org.sleuthkit.datamodel.LocalDirectory;
31 
36 
37  public static String nameForLocalDir(LocalDirectory ld) {
38  return ld.getName();
39  }
40 
41  public LocalDirectoryNode(LocalDirectory ld) {
42  super(ld);
43 
44  this.setDisplayName(nameForLocalDir(ld));
45  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/Folder-icon.png"); //NON-NLS
46 
47  }
48 
49  @Override
50  @NbBundle.Messages({
51  "LocalDirectoryNode.createSheet.name.name=Name",
52  "LocalDirectoryNode.createSheet.name.displayName=Name",
53  "LocalDirectoryNode.createSheet.name.desc=no description",
54  "LocalDirectoryNode.createSheet.noDesc=no description"})
55  protected Sheet createSheet() {
56  Sheet sheet = super.createSheet();
57  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
58  if (sheetSet == null) {
59  sheetSet = Sheet.createPropertiesSet();
60  sheet.put(sheetSet);
61  }
62 
63  List<ContentTag> tags = getContentTagsFromDatabase();
64  sheetSet.put(new NodeProperty<>(Bundle.LocalDirectoryNode_createSheet_name_name(),
65  Bundle.LocalDirectoryNode_createSheet_name_displayName(),
66  Bundle.LocalDirectoryNode_createSheet_name_desc(),
67  getName()));
68 
69  addScoreProperty(sheetSet, tags);
70 
71  CorrelationAttributeInstance correlationAttribute = null;
73  correlationAttribute = getCorrelationAttributeInstance();
74  }
75  addCommentProperty(sheetSet, tags, correlationAttribute);
76 
78  addCountProperty(sheetSet, correlationAttribute);
79  }
80  // At present, a LocalDirectory will never be a datasource - the top level of a logical
81  // file set is a VirtualDirectory
82  Map<String, Object> map = new LinkedHashMap<>();
83  fillPropertyMap(map, getContent());
84 
85  final String NO_DESCR = Bundle.LocalDirectoryNode_createSheet_noDesc();
86  for (Map.Entry<String, Object> entry : map.entrySet()) {
87  sheetSet.put(new NodeProperty<>(entry.getKey(), entry.getKey(), NO_DESCR, entry.getValue()));
88  }
89 
90  return sheet;
91  }
92 
93  @Override
94  public <T> T accept(ContentNodeVisitor<T> visitor) {
95  return visitor.visit(this);
96  }
97 
98  @Override
99  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
100  return visitor.visit(this);
101  }
102 }
static void fillPropertyMap(Map< String, Object > map, AbstractFile content)
final void addCountProperty(Sheet.Set sheetSet, CorrelationAttributeInstance attribute)
final void addCommentProperty(Sheet.Set sheetSet, List< ContentTag > tags, CorrelationAttributeInstance attribute)

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