19 package org.sleuthkit.autopsy.datamodel;
21 import java.sql.ResultSet;
22 import java.sql.SQLException;
23 import java.util.List;
24 import java.util.logging.Level;
26 import org.openide.util.lookup.Lookups;
27 import org.openide.util.Lookup;
31 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
58 this(content, Lookups.singleton(content) );
69 super(
new ContentChildren(content), lookup);
70 this.content = content;
72 super.setName(
"content_" + Long.toString(content.getId()));
91 return super.getName();
115 if( ! c.hasChildren()) {
118 }
catch (TskCoreException ex) {
120 logger.log(Level.SEVERE,
"Error checking if the node has children, for content: " + c, ex);
124 String query =
"SELECT COUNT(obj_id) AS count FROM "
125 +
" ( SELECT obj_id FROM tsk_objects WHERE par_obj_id = " + c.getId() +
" AND type = "
126 + TskData.ObjectType.ARTIFACT.getObjectType()
127 +
" INTERSECT SELECT artifact_obj_id FROM blackboard_artifacts WHERE obj_id = " + c.getId()
128 +
" AND (artifact_type_id = " + ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()
129 +
" OR artifact_type_id = " + ARTIFACT_TYPE.TSK_MESSAGE.getTypeID() +
") "
130 +
" UNION SELECT obj_id FROM tsk_objects WHERE par_obj_id = " + c.getId()
131 +
" AND type = " + TskData.ObjectType.ABSTRACTFILE.getObjectType() +
") AS OBJECT_IDS";
135 ResultSet resultSet = dbQuery.getResultSet();
136 if(resultSet.next()){
137 return (0 < resultSet.getInt(
"count"));
140 logger.log(Level.SEVERE,
"Error checking if the node has children, for content: " + c, ex);
153 boolean hasChildren =
false;
155 if (content != null) {
157 hasChildren = content.hasChildren();
158 }
catch (TskCoreException ex) {
159 logger.log(Level.SEVERE,
"Error checking if the node has children, for content: " + content, ex);
173 List<Long> childrenIds = null;
175 if (content != null) {
177 childrenIds = content.getChildrenIds();
178 }
catch (TskCoreException ex) {
179 logger.log(Level.SEVERE,
"Error getting children ids, for content: " + content, ex);
193 List<Content> children = null;
195 if (content != null) {
197 children = content.getChildren();
198 }
catch (TskCoreException ex) {
199 logger.log(Level.SEVERE,
"Error getting children, for content: " + content, ex);
215 int childrenCount = -1;
217 if (content != null) {
219 childrenCount = content.getChildrenCount();
220 }
catch (TskCoreException ex) {
221 logger.log(Level.SEVERE,
"Error checking node content children count, for content: " + content, ex);
225 return childrenCount;
240 public int read(byte[] buf,
long offset,
long len)
throws TskException {
241 return content.read(buf, offset, len);
int read(byte[] buf, long offset, long len)
List< Content > getContentChildren()
static final Logger logger
void setName(String name)
int getContentChildrenCount()
boolean hasContentChildren()
boolean hasVisibleContentChildren()
SleuthkitCase getSleuthkitCase()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
List< Long > getContentChildrenIds()
static boolean contentHasVisibleContentChildren(Content c)