Autopsy  4.8.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AbstractFsContentNode.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;
30 import org.sleuthkit.datamodel.AbstractFile;
31 import org.sleuthkit.datamodel.ContentTag;
32 
39 public abstract class AbstractFsContentNode<T extends AbstractFile> extends AbstractAbstractFileNode<T> {
40 
41  private static Logger logger = Logger.getLogger(AbstractFsContentNode.class.getName());
42 
43  private boolean directoryBrowseMode;
44  public static final String HIDE_PARENT = "hide_parent"; //NON-NLS
45 
46  AbstractFsContentNode(T fsContent) {
47  this(fsContent, true);
48  }
49 
59  AbstractFsContentNode(T content, boolean directoryBrowseMode) {
60  super(content);
61  this.setDisplayName(AbstractAbstractFileNode.getContentDisplayName(content));
62  this.directoryBrowseMode = directoryBrowseMode;
63  }
64 
65  public boolean getDirectoryBrowseMode() {
66  return directoryBrowseMode;
67  }
68 
69  @Override
70  @NbBundle.Messages("AbstractFsContentNode.noDesc.text=no description")
71  protected Sheet createSheet() {
72  Sheet sheet = super.createSheet();
73  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
74  if (sheetSet == null) {
75  sheetSet = Sheet.createPropertiesSet();
76  sheet.put(sheetSet);
77  }
78  List<ContentTag> tags = getContentTagsFromDatabase();
79  Map<String, Object> map = new LinkedHashMap<>();
80  fillPropertyMap(map, getContent());
81  final String NO_DESCR = Bundle.AbstractFsContentNode_noDesc_text();
82  //add the name property before the comment property to ensure it is first column
83  sheetSet.put(new NodeProperty<>(AbstractFilePropertyType.NAME.toString(),
84  AbstractFilePropertyType.NAME.toString(),
85  NO_DESCR,
86  getName()));
87 
88  addScoreProperty(sheetSet, tags);
89 
90  //add the comment property before the propertyMap to ensure it is early in column order
91  CorrelationAttributeInstance correlationAttribute = null;
93  correlationAttribute = getCorrelationAttributeInstance();
94  }
95  addCommentProperty(sheetSet, tags, correlationAttribute);
96 
98  addCountProperty(sheetSet, correlationAttribute);
99  }
100 
101  for (AbstractFilePropertyType propType : AbstractFilePropertyType.values()) {
102  final String propString = propType.toString();
103  sheetSet.put(new NodeProperty<>(propString, propString, NO_DESCR, map.get(propString)));
104  }
105  if (directoryBrowseMode) {
106  sheetSet.put(new NodeProperty<>(HIDE_PARENT, HIDE_PARENT, HIDE_PARENT, HIDE_PARENT));
107  }
108 
109  return sheet;
110  }
111 
112 }
final void addScoreProperty(Sheet.Set sheetSet, List< ContentTag > tags)
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)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

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.