19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.logging.Level;
37 class ContentChildren
extends AbstractContentChildren<Content> {
39 private static final Logger logger = Logger.getLogger(ContentChildren.class.getName());
41 private final Content parent;
43 ContentChildren(Content parent) {
44 super(
"content_" + Long.toString(parent.getId()));
58 private static List<Content> getDisplayChildren(Content parent) {
60 List<Content> tmpChildren;
62 tmpChildren = parent.getChildren();
63 }
catch (TskCoreException ex) {
64 logger.log(Level.WARNING,
"Error getting Content children.", ex);
65 tmpChildren = Collections.emptyList();
70 List<Content> children =
new ArrayList<>();
71 for (Content c : tmpChildren) {
72 if (c instanceof VolumeSystem) {
73 children.addAll(getDisplayChildren(c));
74 }
else if (c instanceof FileSystem) {
75 children.addAll(getDisplayChildren(c));
76 }
else if (c instanceof Directory) {
77 Directory dir = (Directory) c;
84 if ((dir.isRoot()) && (dir.getName().equals(
".") ==
false)
85 && (dir.getName().equals(
"..") ==
false)) {
86 children.addAll(getDisplayChildren(dir));
90 }
else if (c instanceof LocalDirectory) {
91 LocalDirectory localDir = (LocalDirectory) c;
92 if (localDir.isRoot()) {
93 children.addAll(getDisplayChildren(localDir));
105 protected List<Content> makeKeys() {
106 List<Content> contentList = getDisplayChildren(parent);
110 contentList.forEach(content->{
112 content.getUniquePath();
113 } catch (TskCoreException ex) {
114 logger.log(Level.SEVERE, String.format(
"Failed attempt to cache the "
115 +
"unique path of the abstract file instance. Name: %s (objID=%d)",
116 content.getName(), content.getId()), ex);
124 protected void onAdd() {
133 void refreshChildren() {
138 protected void onRemove() {