19 package org.sleuthkit.autopsy.centralrepository.datamodel;
 
   21 import java.io.Serializable;
 
   22 import java.util.ArrayList;
 
   23 import java.util.List;
 
   24 import java.util.Objects;
 
   25 import java.util.regex.Pattern;
 
   26 import org.openide.util.NbBundle.Messages;
 
   36     "EamArtifactInstances.knownStatus.bad=Bad",
 
   37     "EamArtifactInstances.knownStatus.known=Known",
 
   38     "EamArtifactInstances.knownStatus.unknown=Unknown"})
 
   41     private static final long serialVersionUID = 1L;
 
   55             String correlationValue,
 
   60             TskData.FileKnown knownStatus,
 
   62         this(correlationType, correlationValue, -1, eamCase, eamDataSource, filePath, comment, knownStatus, fileObjectId);
 
   73             TskData.FileKnown knownStatus,
 
   76         if (filePath == null) {
 
   80         this.correlationType = type;
 
   81         this.correlationValue = CorrelationAttributeNormalizer.normalize(type, value);
 
   83         this.correlationCase = eamCase;
 
   84         this.correlationDataSource = eamDataSource;
 
   86         this.filePath = filePath.toLowerCase();
 
   87         this.comment = comment;
 
   88         this.knownStatus = knownStatus;
 
   89         this.objectId = fileObjectId;
 
   93         return ((this.getID() == otherInstance.
getID())
 
   98                 && (this.getFilePath().equals(otherInstance.
getFilePath()))
 
  100                 && (this.getComment().equals(otherInstance.
getComment())));
 
  106                 + this.getCorrelationCase().getCaseUUID()
 
  107                 + this.getCorrelationDataSource().getDeviceID()
 
  109                 + this.getCorrelationType().toString()
 
  110                 + this.getCorrelationValue()
 
  111                 + this.getKnownStatus()
 
  119         return correlationValue;
 
  126         return correlationType;
 
  150         return correlationCase;
 
  157         return correlationDataSource;
 
  171         return null == comment ? 
"" : comment;
 
  178         this.comment = comment;
 
  199         this.knownStatus = knownStatus;
 
  213     public static final int FILES_TYPE_ID = 0;
 
  214     public static final int DOMAIN_TYPE_ID = 1;
 
  215     public static final int EMAIL_TYPE_ID = 2;
 
  216     public static final int PHONE_TYPE_ID = 3;
 
  217     public static final int USBID_TYPE_ID = 4;
 
  218     public static final int SSID_TYPE_ID = 5;
 
  219     public static final int MAC_TYPE_ID = 6;
 
  220     public static final int IMEI_TYPE_ID = 7;
 
  221     public static final int IMSI_TYPE_ID = 8;
 
  222     public static final int ICCID_TYPE_ID = 9;
 
  230     @Messages({
"CorrelationType.FILES.displayName=Files",
 
  231         "CorrelationType.DOMAIN.displayName=Domains",
 
  232         "CorrelationType.EMAIL.displayName=Email Addresses",
 
  233         "CorrelationType.PHONE.displayName=Phone Numbers",
 
  234         "CorrelationType.USBID.displayName=USB Devices",
 
  235         "CorrelationType.SSID.displayName=Wireless Networks",
 
  236         "CorrelationType.MAC.displayName=MAC Addresses",
 
  237         "CorrelationType.IMEI.displayName=IMEI Number",
 
  238         "CorrelationType.IMSI.displayName=IMSI Number",
 
  239         "CorrelationType.ICCID.displayName=ICCID Number"})
 
  244         DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttributeInstance.
Type(EMAIL_TYPE_ID, Bundle.CorrelationType_EMAIL_displayName(), 
"email_address", 
true, 
true)); 
 
  245         DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttributeInstance.
Type(PHONE_TYPE_ID, Bundle.CorrelationType_PHONE_displayName(), 
"phone_number", 
true, 
true)); 
 
  247         DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttributeInstance.
Type(SSID_TYPE_ID, Bundle.CorrelationType_SSID_displayName(), 
"wireless_networks", 
true, 
true)); 
 
  251         DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttributeInstance.
Type(ICCID_TYPE_ID, Bundle.CorrelationType_ICCID_displayName(), 
"iccid_number", 
true, 
true)); 
 
  252         return DEFAULT_CORRELATION_TYPES;
 
  258     @SuppressWarnings(
"serial")
 
  259     public static class 
Type implements Serializable { 
 
  266         private final static String DB_NAMES_REGEX = 
"[a-z][a-z0-9_]*";
 
  279         public Type(
int typeId, String displayName, String dbTableName, Boolean supported, Boolean enabled) 
throws EamDbException {
 
  280             if (dbTableName == null) {
 
  283             this.typeId = typeId;
 
  284             this.displayName = displayName;
 
  285             this.dbTableName = dbTableName;
 
  286             this.supported = supported;
 
  287             this.enabled = enabled;
 
  288             if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
 
  289                 throw new EamDbException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); 
 
  306         public Type(String displayName, String dbTableName, Boolean supported, Boolean enabled) 
throws EamDbException {
 
  307             this(-1, displayName, dbTableName, supported, enabled);
 
  337             return this.typeId == that.getId()
 
  338                     && Objects.equals(this.supported, that.isSupported())
 
  339                     && Objects.equals(
this.enabled, that.isEnabled());
 
  345             hash = 67 * hash + Objects.hashCode(this.typeId);
 
  346             hash = 67 * hash + Objects.hashCode(this.supported);
 
  347             hash = 67 * hash + Objects.hashCode(this.enabled);
 
  353             StringBuilder str = 
new StringBuilder(55);
 
  356                     .append(
", displayName=")
 
  357                     .append(getDisplayName())
 
  358                     .append(
", dbTableName=")
 
  359                     .append(getDbTableName())
 
  360                     .append(
", supported=")
 
  361                     .append(isSupported().toString())
 
  362                     .append(
", enabled=")
 
  363                     .append(isEnabled().toString())
 
  365             return str.toString();
 
  379             this.typeId = typeId;
 
  397             this.supported = supported;
 
  415             this.enabled = enabled;
 
  429             this.displayName = displayName;
 
  472             if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
 
  473                 throw new EamDbException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); 
 
  475             this.dbTableName = dbTableName;
 
Type(String displayName, String dbTableName, Boolean supported, Boolean enabled)
boolean isDatabaseInstance()
TskData.FileKnown knownStatus
static List< CorrelationAttributeInstance.Type > getDefaultCorrelationTypes()
CorrelationDataSource correlationDataSource
boolean sameType(CorrelationAttributeInstance.Type that)
String getCorrelationValue()
void setDisplayName(String displayName)
TskData.FileKnown getKnownStatus()
Type getCorrelationType()
Type(int typeId, String displayName, String dbTableName, Boolean supported, Boolean enabled)
void setSupported(Boolean supported)
CorrelationAttributeInstance(CorrelationAttributeInstance.Type correlationType, String correlationValue, CorrelationCase eamCase, CorrelationDataSource eamDataSource, String filePath, String comment, TskData.FileKnown knownStatus, long fileObjectId)
CorrelationAttributeInstance.Type correlationType
CorrelationCase correlationCase
void setKnownStatus(TskData.FileKnown knownStatus)
boolean equals(Object that)
CorrelationDataSource getCorrelationDataSource()
CorrelationCase getCorrelationCase()
void setEnabled(Boolean enabled)
void setDbTableName(String dbTableName)
void setComment(String comment)
Boolean equals(CorrelationAttributeInstance otherInstance)