19 package org.sleuthkit.autopsy.datamodel;
 
   21 import java.text.SimpleDateFormat;
 
   22 import java.util.Arrays;
 
   23 import java.util.logging.Level;
 
   24 import org.apache.commons.lang.StringUtils;
 
   25 import org.openide.util.NbBundle;
 
   26 import org.openide.util.NbBundle.Messages;
 
   41     private final static SimpleDateFormat 
dateFormatter = 
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
 
   64         "ArtifactStringContent.attrsTableHeader.type=Type",
 
   65         "ArtifactStringContent.attrsTableHeader.value=Value",
 
   66         "ArtifactStringContent.attrsTableHeader.sources=Source(s)",
 
   67         "ArtifactStringContent.failedToGetSourcePath.message=Failed to get source file path from case database",
 
   68         "ArtifactStringContent.failedToGetAttributes.message=Failed to get some or all attributes from case database" 
   72         if (stringContent.isEmpty()) {
 
   76             StringBuilder buffer = 
new StringBuilder(1024);
 
   77             buffer.append(
"<html>\n"); 
 
   78             buffer.append(
"<body>\n"); 
 
   83             buffer.append(
"<h3>"); 
 
   85             buffer.append(
"</h3>\n"); 
 
   91             buffer.append(
"<table border='1'>"); 
 
   94             buffer.append(
"<tr>"); 
 
   95             buffer.append(
"<th><b>"); 
 
   96             buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_type());
 
   97             buffer.append(
"</b></th>"); 
 
   98             buffer.append(
"<th><b>"); 
 
   99             buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_value());
 
  100             buffer.append(
"</b></th>"); 
 
  101             buffer.append(
"<th><b>"); 
 
  102             buffer.append(Bundle.ArtifactStringContent_attrsTableHeader_sources());
 
  103             buffer.append(
"</b></th>"); 
 
  104             buffer.append(
"</tr>\n"); 
 
  117                     switch (attr.getAttributeType().getValueType()) {
 
  124                             value = attr.getDisplayString();
 
  129                             long epoch = attr.getValueLong();
 
  130                             value = 
"0000-00-00 00:00:00";
 
  131                             if (null != content && 0 != epoch) {
 
  133                                 value = dateFormatter.format(
new java.util.Date(epoch * 1000));
 
  141                     String sources = StringUtils.join(attr.getSources(), 
", ");
 
  142                     buffer.append(
makeTableRow(attr.getAttributeType().getDisplayName(), value, sources));
 
  151                     if (null != content) {
 
  155                     logger.log(Level.SEVERE, String.format(
"Error getting source content path for artifact (artifact_id=%d, obj_id=%d)", artifact.
getArtifactID(), artifact.
getObjectID()), ex);
 
  156                     path = Bundle.ArtifactStringContent_failedToGetSourcePath_message();
 
  159                 buffer.append(
makeTableRow(NbBundle.getMessage(
this.getClass(), 
"ArtifactStringContent.getStr.srcFilePath.text"),
 
  166                 buffer.append(
makeTableRow(NbBundle.getMessage(
this.getClass(), 
"ArtifactStringContent.getStr.artifactId.text"),
 
  170                 logger.log(Level.SEVERE, String.format(
"Error getting data for artifact (artifact_id=%d)", artifact.
getArtifactID()), ex);
 
  171                 buffer.append(
makeTableRow(Bundle.ArtifactStringContent_failedToGetAttributes_message(), 
"", 
""));                
 
  176                 buffer.append(
"</table>"); 
 
  177                 buffer.append(
"</html>\n"); 
 
  178                 stringContent = buffer.toString();
 
  187         str = str.replaceAll(
" ", 
" "); 
 
  188         str = str.replaceAll(
"<", 
"<"); 
 
  189         str = str.replaceAll(
">", 
">"); 
 
  190         str = str.replaceAll(
"(\r\n|\n)", 
"<br />"); 
 
  201     private String 
makeTableRow(String type, String value, String source) {
 
static final SimpleDateFormat dateFormatter
 
Content getContentById(long id)
 
ArtifactStringContent(BlackboardArtifact artifact)
 
SleuthkitCase getSleuthkitCase()
 
String makeTableRow(String type, String value, String source)
 
static final Logger logger
 
String escapeHtmlString(String str)
 
List< BlackboardAttribute > getAttributes()
 
synchronized static Logger getLogger(String name)
 
static TimeZone getTimeZone(Content c)
 
final BlackboardArtifact artifact