19 package org.sleuthkit.autopsy.datamodel;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.Comparator;
26 import java.util.EnumSet;
27 import java.util.HashMap;
28 import java.util.List;
30 import java.util.logging.Level;
31 import org.openide.nodes.ChildFactory;
32 import org.openide.nodes.Children;
33 import org.openide.nodes.Node;
34 import org.openide.nodes.Sheet;
35 import org.openide.util.NbBundle;
36 import org.openide.util.lookup.Lookups;
45 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT;
46 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT;
47 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_TL_EVENT;
48 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DATA_SOURCE_USAGE;
49 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG;
50 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_GEN_INFO;
51 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT;
52 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT;
53 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT;
54 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT;
55 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_DOWNLOAD_SOURCE;
67 public static final String
NAME = NbBundle.getMessage(
RootNode.class,
"ExtractedContentNode.name.text");
89 this.filteringDSObjId = objId;
90 this.blackboard = skCase.getBlackboard();
95 return visitor.
visit(
this);
105 super(Children.create(
new TypeFactory(),
true), Lookups.singleton(NAME));
107 super.setDisplayName(NAME);
108 this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/images/extracted_content.png");
118 return visitor.
visit(
this);
123 Sheet sheet = super.createSheet();
124 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
125 if (sheetSet == null) {
126 sheetSet = Sheet.createPropertiesSet();
130 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.name"),
131 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.displayName"),
132 NbBundle.getMessage(
this.getClass(),
"ExtractedContentNode.createSheet.name.desc"),
139 return getClass().getName();
150 private final ArrayList<BlackboardArtifact.Type>
doNotShow =
new ArrayList<>();
161 @SuppressWarnings(
"deprecation")
166 doNotShow.add(
new BlackboardArtifact.Type(TSK_GEN_INFO));
167 doNotShow.add(
new BlackboardArtifact.Type(TSK_EMAIL_MSG));
168 doNotShow.add(
new BlackboardArtifact.Type(TSK_HASHSET_HIT));
169 doNotShow.add(
new BlackboardArtifact.Type(TSK_KEYWORD_HIT));
170 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_FILE_HIT));
171 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_ARTIFACT_HIT));
172 doNotShow.add(
new BlackboardArtifact.Type(TSK_ACCOUNT));
173 doNotShow.add(
new BlackboardArtifact.Type(TSK_DATA_SOURCE_USAGE));
174 doNotShow.add(
new BlackboardArtifact.Type(TSK_DOWNLOAD_SOURCE));
175 doNotShow.add(
new BlackboardArtifact.Type(TSK_TL_EVENT));
178 doNotShow.add(
new BlackboardArtifact.Type(TSK_ASSOCIATED_OBJECT));
181 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
182 String eventType = evt.getPropertyName();
185 if (evt.getNewValue() == null) {
219 typeNodeList.clear();
223 protected boolean createKeys(List<BlackboardArtifact.Type> list) {
224 if (skCase != null) {
226 List<BlackboardArtifact.Type> types = (filteringDSObjId > 0)
227 ? blackboard.getArtifactTypesInUse(filteringDSObjId)
228 : skCase.getArtifactTypesInUse();
231 Collections.sort(types,
232 new Comparator<BlackboardArtifact.Type>() {
234 public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) {
235 return a.getDisplayName().compareTo(b.getDisplayName());
242 for (BlackboardArtifact.Type art : types) {
243 TypeNode node = typeNodeList.get(art);
245 node.updateDisplayName();
248 }
catch (TskCoreException ex) {
249 Logger.
getLogger(
TypeFactory.class.getName()).log(Level.SEVERE,
"Error getting list of artifacts in use: " + ex.getLocalizedMessage());
258 typeNodeList.put(key, node);
269 String eventType = evt.getPropertyName();
284 if (null != event && !(this.
doNotShow.contains(event.getBlackboardArtifactType()))) {
305 private final BlackboardArtifact.Type
type;
310 super.setName(
type.getTypeName());
313 setIconBaseWithExtension(iconPath != null && iconPath.charAt(0) ==
'/' ? iconPath.substring(1) : iconPath);
317 final void updateDisplayName() {
318 if (skCase == null) {
326 this.childCount = (filteringDSObjId > 0)
328 : skCase.getBlackboardArtifactsTypeCount(
type.getTypeID());
329 }
catch (TskCoreException ex) {
330 Logger.getLogger(TypeNode.class.getName())
331 .log(Level.WARNING,
"Error getting child count", ex);
333 super.setDisplayName(
type.
getDisplayName() +
" \u200E(\u200E" + childCount +
")\u200E");
338 Sheet sheet = super.createSheet();
339 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
340 if (sheetSet == null) {
341 sheetSet = Sheet.createPropertiesSet();
345 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.name"),
346 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.displayName"),
347 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.desc"),
350 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.name"),
351 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.displayName"),
352 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.desc"),
360 return visitor.
visit(
this);
379 private final BlackboardArtifact.Type
type;
389 super(
type.getTypeName());
393 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
394 String eventType = evt.getPropertyName();
433 if (skCase != null) {
435 List<BlackboardArtifact> arts;
436 if (filteringDSObjId > 0) {
439 arts = skCase.getBlackboardArtifacts(
type.getTypeID());
441 for (BlackboardArtifact art : arts) {
447 }
catch (TskCoreException ex) {
451 return Collections.emptyList();
461 String eventType = evt.getPropertyName();
479 if (null != event && event.getBlackboardArtifactType().equals(
type)) {
void registerForIngestModuleEvents()
static synchronized IngestManager getInstance()
void unregisterEventListener()
T visit(DataSourcesNode in)
void removeIngestJobEventListener(final PropertyChangeListener listener)
void addIngestJobEventListener(final PropertyChangeListener listener)
static String getIconFilePath(int typeID)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)