19 package org.sleuthkit.autopsy.datamodel;
21 import java.util.logging.Level;
22 import org.apache.commons.lang.StringUtils;
23 import org.openide.util.NbBundle;
24 import org.openide.util.NbBundle.Messages;
65 "ArtifactStringContent.attrsTableHeader.type=Type",
66 "ArtifactStringContent.attrsTableHeader.value=Value",
67 "ArtifactStringContent.attrsTableHeader.sources=Source(s)",
68 "ArtifactStringContent.failedToGetSourcePath.message=Failed to get source file path from case database",
69 "ArtifactStringContent.failedToGetAttributes.message=Failed to get some or all attributes from case database"
73 if (stringContent.isEmpty()) {
77 StringBuilder buffer =
new StringBuilder(1024);
78 buffer.append(
"<html>\n");
79 buffer.append(
"<body>\n");
84 buffer.append(
"<h3>");
85 buffer.append(artifact.getDisplayName());
86 buffer.append(
"</h3>\n");
92 buffer.append(
"<table border='1'>");
95 buffer.append(
"<tr>");
96 buffer.append(
"<th><b>");
97 buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_type());
98 buffer.append(
"</b></th>");
99 buffer.append(
"<th><b>");
100 buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_value());
101 buffer.append(
"</b></th>");
102 buffer.append(
"<th><b>");
103 buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_sources());
104 buffer.append(
"</b></th>");
105 buffer.append(
"</tr>\n");
107 Content content = artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
112 for (BlackboardAttribute attr : artifact.getAttributes()) {
118 switch (attr.getAttributeType().getValueType()) {
126 value = attr.getDisplayString();
131 long epoch = attr.getValueLong();
139 String sources = StringUtils.join(attr.getSources(),
", ");
140 buffer.append(
makeTableRow(attr.getAttributeType().getDisplayName(), value, sources));
149 if (null != content) {
150 path = content.getUniquePath();
152 }
catch (TskCoreException ex) {
153 logger.log(Level.SEVERE, String.format(
"Error getting source content path for artifact (artifact_id=%d, obj_id=%d)", artifact.getArtifactID(), artifact.getObjectID()), ex);
154 path = Bundle.ArtifactStringContent_failedToGetSourcePath_message();
157 buffer.append(
makeTableRow(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.srcFilePath.text"),
164 buffer.append(
makeTableRow(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.artifactId.text"),
165 Long.toString(artifact.getArtifactID()),
""));
167 }
catch (TskCoreException ex) {
168 logger.log(Level.SEVERE, String.format(
"Error getting data for artifact (artifact_id=%d)", artifact.getArtifactID()), ex);
169 buffer.append(
makeTableRow(Bundle.ArtifactStringContent_failedToGetAttributes_message(),
"",
""));
174 buffer.append(
"</table>");
175 buffer.append(
"</html>\n");
176 stringContent = buffer.toString();
185 str = str.replaceAll(
" ",
" ");
186 str = str.replaceAll(
"<",
"<");
187 str = str.replaceAll(
">",
">");
188 str = str.replaceAll(
"(\r\n|\n)",
"<br />");
199 private String
makeTableRow(String type, String value, String source) {
static String getFormattedTime(long epochTime)
ArtifactStringContent(BlackboardArtifact artifact)
String makeTableRow(String type, String value, String source)
static final Logger logger
String escapeHtmlString(String str)
synchronized static Logger getLogger(String name)
final BlackboardArtifact artifact