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         @Messages({
"CorrelationAttributeInstance.nullName.message=Database name is null.",
 
  280                    "CorrelationAttributeInstance.invalidName.message=Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."})
 
  281         public Type(
int typeId, String displayName, String dbTableName, Boolean supported, Boolean enabled) 
throws EamDbException {
 
  282             if (dbTableName == null) {
 
  283                 throw new EamDbException(Bundle.CorrelationAttributeInstance_nullName_message());
 
  285             this.typeId = typeId;
 
  286             this.displayName = displayName;
 
  287             this.dbTableName = dbTableName;
 
  288             this.supported = supported;
 
  289             this.enabled = enabled;
 
  290             if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
 
  291                 throw new EamDbException(Bundle.CorrelationAttributeInstance_invalidName_message()); 
 
  308         public Type(String displayName, String dbTableName, Boolean supported, Boolean enabled) 
throws EamDbException {
 
  309             this(-1, displayName, dbTableName, supported, enabled);
 
  339             return this.typeId == that.getId()
 
  340                     && Objects.equals(this.supported, that.isSupported())
 
  341                     && Objects.equals(
this.enabled, that.isEnabled());
 
  347             hash = 67 * hash + Objects.hashCode(this.typeId);
 
  348             hash = 67 * hash + Objects.hashCode(this.supported);
 
  349             hash = 67 * hash + Objects.hashCode(this.enabled);
 
  355             StringBuilder str = 
new StringBuilder(55);
 
  358                     .append(
", displayName=")
 
  359                     .append(getDisplayName())
 
  360                     .append(
", dbTableName=")
 
  361                     .append(getDbTableName())
 
  362                     .append(
", supported=")
 
  363                     .append(isSupported().toString())
 
  364                     .append(
", enabled=")
 
  365                     .append(isEnabled().toString())
 
  367             return str.toString();
 
  381             this.typeId = typeId;
 
  399             this.supported = supported;
 
  417             this.enabled = enabled;
 
  431             this.displayName = displayName;
 
  474             if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
 
  475                 throw new EamDbException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."); 
 
  477             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)