Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
PoolNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 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.ArrayList;
22 import java.util.List;
23 import javax.swing.Action;
24 import org.apache.commons.lang3.tuple.Pair;
25 import org.openide.nodes.Sheet;
26 import org.openide.util.NbBundle;
30 import org.sleuthkit.datamodel.Pool;
31 import org.sleuthkit.datamodel.Tag;
32 
36 public class PoolNode extends AbstractContentNode<Pool> {
37 
46  static String nameForPool(Pool pool) {
47  return pool.getType().getName();
48  }
49 
54  public PoolNode(Pool pool) {
55  super(pool);
56 
57  // set name, display name, and icon
58  String poolName = nameForPool(pool);
59  this.setDisplayName(poolName);
60 
61  this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/pool-icon.png"); //NON-NLS
62  }
63 
71  @Override
72  public Action[] getActions(boolean popup) {
73  List<Action> actionsList = new ArrayList<>();
74 
75  for (Action a : super.getActions(true)) {
76  actionsList.add(a);
77  }
78 
79  return actionsList.toArray(new Action[actionsList.size()]);
80 
81  }
82 
83  @NbBundle.Messages({
84  "PoolNode.createSheet.name.name=Name",
85  "PoolNode.createSheet.name.displayName=Name",
86  "PoolNode.createSheet.name.desc=no description",
87  "PoolNode.createSheet.type.name=Type",
88  "PoolNode.createSheet.type.displayName=Type",
89  "PoolNode.createSheet.type.desc=no description",
90  })
91  @Override
92  protected Sheet createSheet() {
93  Sheet sheet = super.createSheet();
94  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
95  if (sheetSet == null) {
96  sheetSet = Sheet.createPropertiesSet();
97  sheet.put(sheetSet);
98  }
99 
100  Pool pool = this.getContent();
101  sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_name_name(),
102  Bundle.PoolNode_createSheet_name_displayName(),
103  Bundle.PoolNode_createSheet_name_desc(),
104  this.getDisplayName()));
105  sheetSet.put(new NodeProperty<>(Bundle.PoolNode_createSheet_type_name(),
106  Bundle.PoolNode_createSheet_type_displayName(),
107  Bundle.PoolNode_createSheet_type_desc(),
108  pool.getType().getName()));
109 
110  return sheet;
111  }
112 
113  @Override
114  public <T> T accept(ContentNodeVisitor<T> visitor) {
115  return visitor.visit(this);
116  }
117 
118  @Override
119  public boolean isLeafTypeNode() {
120  return false;
121  }
122 
123  @Override
124  public <T> T accept(DisplayableItemNodeVisitor<T> visitor) {
125  return visitor.visit(this);
126  }
127 
128  @Override
129  public String getItemType() {
130  return getClass().getName();
131  }
132 
140  @Override
141  protected List<Tag> getAllTagsFromDatabase() {
142  return new ArrayList<>();
143  }
144 
154  @Override
156  return null;
157  }
158 
168  @Override
169  protected Pair<DataResultViewerTable.Score, String> getScorePropertyAndDescription(List<Tag> tags) {
170  return Pair.of(DataResultViewerTable.Score.NO_SCORE, NO_DESCR);
171  }
172 
183  @Override
186  }
187 
200  @Override
201  protected Pair<Long, String> getCountPropertyAndDescription(CorrelationAttributeInstance.Type attributeType, String attributeValue, String defaultDescription) {
202  return Pair.of(-1L, NO_DESCR);
203  }
204 }
Pair< DataResultViewerTable.Score, String > getScorePropertyAndDescription(List< Tag > tags)
Definition: PoolNode.java:169
Action[] getActions(boolean popup)
Definition: PoolNode.java:72
DataResultViewerTable.HasCommentStatus getCommentProperty(List< Tag > tags, CorrelationAttributeInstance attribute)
Definition: PoolNode.java:184
Pair< Long, String > getCountPropertyAndDescription(CorrelationAttributeInstance.Type attributeType, String attributeValue, String defaultDescription)
Definition: PoolNode.java:201
CorrelationAttributeInstance getCorrelationAttributeInstance()
Definition: PoolNode.java:155

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