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();
148 private class TypeFactory extends ChildFactory.Detachable<BlackboardArtifact.Type> {
150 private final ArrayList<BlackboardArtifact.Type>
doNotShow =
new ArrayList<>();
154 @SuppressWarnings(
"deprecation")
159 doNotShow.add(
new BlackboardArtifact.Type(TSK_GEN_INFO));
160 doNotShow.add(
new BlackboardArtifact.Type(TSK_EMAIL_MSG));
161 doNotShow.add(
new BlackboardArtifact.Type(TSK_HASHSET_HIT));
162 doNotShow.add(
new BlackboardArtifact.Type(TSK_KEYWORD_HIT));
163 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_FILE_HIT));
164 doNotShow.add(
new BlackboardArtifact.Type(TSK_INTERESTING_ARTIFACT_HIT));
165 doNotShow.add(
new BlackboardArtifact.Type(TSK_ACCOUNT));
166 doNotShow.add(
new BlackboardArtifact.Type(TSK_DATA_SOURCE_USAGE));
167 doNotShow.add(
new BlackboardArtifact.Type(TSK_DOWNLOAD_SOURCE));
168 doNotShow.add(
new BlackboardArtifact.Type(TSK_TL_EVENT));
171 doNotShow.add(
new BlackboardArtifact.Type(TSK_ASSOCIATED_OBJECT));
174 private final PropertyChangeListener
pcl = (PropertyChangeEvent evt) -> {
175 String eventType = evt.getPropertyName();
190 if (null != event && !(this.
doNotShow.contains(event.getBlackboardArtifactType()))) {
215 if (evt.getNewValue() == null) {
234 typeNodeList.clear();
238 protected boolean createKeys(List<BlackboardArtifact.Type> list) {
239 if (skCase != null) {
241 List<BlackboardArtifact.Type> types = (filteringDSObjId > 0)
242 ? blackboard.getArtifactTypesInUse(filteringDSObjId)
243 : skCase.getArtifactTypesInUse();
246 Collections.sort(types,
247 new Comparator<BlackboardArtifact.Type>() {
249 public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) {
250 return a.getDisplayName().compareTo(b.getDisplayName());
257 for (BlackboardArtifact.Type art : types) {
258 TypeNode node = typeNodeList.get(art);
260 node.updateDisplayName();
263 }
catch (TskCoreException ex) {
264 Logger.
getLogger(
TypeFactory.class.getName()).log(Level.SEVERE,
"Error getting list of artifacts in use: " + ex.getLocalizedMessage());
273 typeNodeList.put(key, node);
286 private final BlackboardArtifact.Type
type;
291 super.setName(
type.getTypeName());
297 final void updateDisplayName() {
298 if (skCase == null) {
306 this.childCount = (filteringDSObjId > 0)
308 : skCase.getBlackboardArtifactsTypeCount(
type.getTypeID());
309 }
catch (TskCoreException ex) {
310 Logger.getLogger(TypeNode.class.getName())
311 .log(Level.WARNING,
"Error getting child count", ex);
313 super.setDisplayName(
type.
getDisplayName() +
" \u200E(\u200E" + childCount +
")\u200E");
318 Sheet sheet = super.createSheet();
319 Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
320 if (sheetSet == null) {
321 sheetSet = Sheet.createPropertiesSet();
325 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.name"),
326 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.displayName"),
327 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.artType.desc"),
330 sheetSet.put(
new NodeProperty<>(NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.name"),
331 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.displayName"),
332 NbBundle.getMessage(
this.getClass(),
"ArtifactTypeNode.createSheet.childCnt.desc"),
340 return visitor.
visit(
this);
359 private BlackboardArtifact.Type
type;
362 super(
type.getTypeName());
366 private final PropertyChangeListener
pcl =
new PropertyChangeListener() {
368 public void propertyChange(PropertyChangeEvent evt) {
369 String eventType = evt.getPropertyName();
386 if (null != event && event.getBlackboardArtifactType().equals(
type)) {
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();
void removeIngestModuleEventListener(final PropertyChangeListener listener)
static synchronized IngestManager getInstance()
T visit(DataSourcesNode in)
void removeIngestJobEventListener(final PropertyChangeListener listener)
void addIngestJobEventListener(final PropertyChangeListener listener)
static String getIconFilePath(int typeID)
void addIngestModuleEventListener(final PropertyChangeListener listener)
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)