Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
DisplayableItemNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012-2020 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 org.openide.nodes.AbstractNode;
22 import org.openide.nodes.Children;
23 import org.openide.nodes.Sheet;
24 import org.openide.util.Lookup;
25 import org.sleuthkit.datamodel.AbstractFile;
26 import org.sleuthkit.datamodel.BlackboardArtifact;
27 import org.sleuthkit.datamodel.BlackboardAttribute;
28 import org.sleuthkit.datamodel.TskCoreException;
29 
38 public abstract class DisplayableItemNode extends AbstractNode {
39 
40  /*
41  * An item type shared by DisplayableItemNodes that can be the parents of
42  * file nodes.
43  */
44  static final String FILE_PARENT_NODE_KEY = "orgsleuthkitautopsydatamodel" + "FileTypeParentNode";
45 
55  static AbstractFile findLinked(BlackboardArtifact artifact) throws TskCoreException {
56  BlackboardAttribute pathIDAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID));
57  if (pathIDAttribute != null) {
58  long contentID = pathIDAttribute.getValueLong();
59  if (contentID != -1) {
60  return artifact.getSleuthkitCase().getAbstractFileById(contentID);
61  }
62  }
63  return null;
64  }
65 
67 
78  public DisplayableItemNode(Children children) {
79  super(children);
80  }
81 
93  public DisplayableItemNode(Children children, Lookup lookup) {
94  super(children, lookup);
95  }
96 
108  public abstract <T> T accept(DisplayableItemNodeVisitor<T> visitor);
109 
116  public abstract boolean isLeafTypeNode();
117 
123  public abstract String getItemType();
124 
131  public void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo) {
132  this.selectedChildNodeInfo = selectedChildNodeInfo;
133  }
134 
143  return selectedChildNodeInfo;
144  }
145 
152  protected synchronized final void updatePropertySheet(NodeProperty<?>... newProps) {
153  Sheet currentSheet = this.getSheet();
154  Sheet.Set currentPropsSet = currentSheet.get(Sheet.PROPERTIES);
155  Property<?>[] currentProps = currentPropsSet.getProperties();
156  for (NodeProperty<?> newProp : newProps) {
157  for (int i = 0; i < currentProps.length; i++) {
158  if (currentProps[i].getName().equals(newProp.getName())) {
159  currentProps[i] = newProp;
160  }
161  }
162  }
163  currentPropsSet.put(currentProps);
164  currentSheet.put(currentPropsSet);
165  this.setSheet(currentSheet);
166  }
167 
168 }
abstract< T > T accept(DisplayableItemNodeVisitor< T > visitor)
synchronized final void updatePropertySheet(NodeProperty<?>...newProps)
void setChildNodeSelectionInfo(NodeSelectionInfo selectedChildNodeInfo)

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