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;
30 import org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
57 this(content, Lookups.singleton(content) );
68 super(
new ContentChildren(content), lookup);
69 this.content = content;
71 super.setName(
"content_" + Long.toString(content.getId()));
90 return super.getName();
112 String query =
"SELECT COUNT(obj_id) AS count FROM "
113 +
" ( SELECT obj_id FROM tsk_objects WHERE par_obj_id = " + c.getId() +
" AND type = "
114 + TskData.ObjectType.ARTIFACT.getObjectType()
115 +
" INTERSECT SELECT artifact_obj_id FROM blackboard_artifacts WHERE obj_id = " + c.getId()
116 +
" AND (artifact_type_id = " + ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()
117 +
" OR artifact_type_id = " + ARTIFACT_TYPE.TSK_MESSAGE.getTypeID() +
") "
118 +
" UNION SELECT obj_id FROM tsk_objects WHERE par_obj_id = " + c.getId()
119 +
" AND type = " + TskData.ObjectType.ABSTRACTFILE.getObjectType() +
") AS OBJECT_IDS";
123 ResultSet resultSet = dbQuery.getResultSet();
124 if(resultSet.next()){
125 return (0 < resultSet.getInt(
"count"));
127 }
catch (TskCoreException | SQLException ex) {
128 logger.log(Level.SEVERE,
"Error checking if the node has children, for content: " + c, ex);
141 boolean hasChildren =
false;
143 if (content != null) {
145 hasChildren = content.hasChildren();
146 }
catch (TskCoreException ex) {
147 logger.log(Level.SEVERE,
"Error checking if the node has children, for content: " + content, ex);
161 List<Long> childrenIds = null;
163 if (content != null) {
165 childrenIds = content.getChildrenIds();
166 }
catch (TskCoreException ex) {
167 logger.log(Level.SEVERE,
"Error getting children ids, for content: " + content, ex);
181 List<Content> children = null;
183 if (content != null) {
185 children = content.getChildren();
186 }
catch (TskCoreException ex) {
187 logger.log(Level.SEVERE,
"Error getting children, for content: " + content, ex);
203 int childrenCount = -1;
205 if (content != null) {
207 childrenCount = content.getChildrenCount();
208 }
catch (TskCoreException ex) {
209 logger.log(Level.SEVERE,
"Error checking node content children count, for content: " + content, ex);
213 return childrenCount;
228 public int read(byte[] buf,
long offset,
long len)
throws TskException {
229 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()
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
List< Long > getContentChildrenIds()
static boolean contentHasVisibleContentChildren(Content c)