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;
37 "EamArtifactInstances.knownStatus.bad=Bad",
38 "EamArtifactInstances.knownStatus.known=Known",
39 "EamArtifactInstances.knownStatus.unknown=Unknown"})
42 private static final long serialVersionUID = 1L;
57 String correlationValue,
62 TskData.FileKnown knownStatus,
64 this(correlationType, correlationValue, -1, eamCase, eamDataSource, filePath, comment, knownStatus, fileObjectId);
75 TskData.FileKnown knownStatus,
78 this(type, value, -1, eamCase, eamDataSource, filePath, comment, knownStatus, fileObjectId, (long)-1);
84 CorrelationCase eamCase,
85 CorrelationDataSource eamDataSource,
88 TskData.FileKnown knownStatus,
92 if (filePath == null) {
96 this.correlationType = type;
97 this.correlationValue = CorrelationAttributeNormalizer.normalize(type, value);
99 this.correlationCase = eamCase;
100 this.correlationDataSource = eamDataSource;
102 this.filePath = filePath.toLowerCase();
103 this.comment = comment;
104 this.knownStatus = knownStatus;
105 this.objectId = fileObjectId;
106 this.accountId = accountId;
110 return ((this.getID() == otherInstance.
getID())
115 && (this.getFilePath().equals(otherInstance.
getFilePath()))
117 && (this.getComment().equals(otherInstance.
getComment()))
118 && (this.getAccountId().equals(otherInstance.
getAccountId())));
124 + this.getCorrelationCase().getCaseUUID()
125 + this.getCorrelationDataSource().getDeviceID()
126 + this.getAccountId()
128 + this.getCorrelationType().toString()
129 + this.getCorrelationValue()
130 + this.getKnownStatus()
138 return correlationValue;
145 return correlationType;
169 return correlationCase;
176 return correlationDataSource;
190 return null == comment ?
"" : comment;
197 this.comment = comment;
218 this.knownStatus = knownStatus;
245 void setAccountId(Long accountId) {
246 this.accountId = accountId;
250 public static final int FILES_TYPE_ID = 0;
251 public static final int DOMAIN_TYPE_ID = 1;
252 public static final int EMAIL_TYPE_ID = 2;
253 public static final int PHONE_TYPE_ID = 3;
254 public static final int USBID_TYPE_ID = 4;
255 public static final int SSID_TYPE_ID = 5;
256 public static final int MAC_TYPE_ID = 6;
257 public static final int IMEI_TYPE_ID = 7;
258 public static final int IMSI_TYPE_ID = 8;
259 public static final int ICCID_TYPE_ID = 9;
262 public static final int ADDITIONAL_TYPES_BASE_ID = 1000;
270 @Messages({
"CorrelationType.FILES.displayName=Files",
271 "CorrelationType.DOMAIN.displayName=Domains",
272 "CorrelationType.EMAIL.displayName=Email Addresses",
273 "CorrelationType.PHONE.displayName=Phone Numbers",
274 "CorrelationType.USBID.displayName=USB Devices",
275 "CorrelationType.SSID.displayName=Wireless Networks",
276 "CorrelationType.MAC.displayName=MAC Addresses",
277 "CorrelationType.IMEI.displayName=IMEI Number",
278 "CorrelationType.IMSI.displayName=IMSI Number",
279 "CorrelationType.ICCID.displayName=ICCID Number"})
288 defaultCorrelationTypes.add(
new CorrelationAttributeInstance.
Type(SSID_TYPE_ID, Bundle.CorrelationType_SSID_displayName(),
"wireless_networks",
true,
true));
295 int correlationTypeId = ADDITIONAL_TYPES_BASE_ID;
296 for (Account.Type type : Account.Type.PREDEFINED_ACCOUNT_TYPES) {
299 if (type != Account.Type.DEVICE && type != Account.Type.EMAIL && type != Account.Type.PHONE) {
300 defaultCorrelationTypes.add(
new CorrelationAttributeInstance.
Type(correlationTypeId, type.getDisplayName(), type.getTypeName().toLowerCase() +
"_acct",
true,
true));
305 return defaultCorrelationTypes;
311 @SuppressWarnings(
"serial")
312 public static class
Type implements Serializable {
319 private final static String DB_NAMES_REGEX =
"[a-z][a-z0-9_]*";
332 @Messages({
"CorrelationAttributeInstance.nullName.message=Database name is null.",
333 "CorrelationAttributeInstance.invalidName.message=Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'."})
335 if (dbTableName == null) {
336 throw new CentralRepoException(
"dbTableName is null", Bundle.CorrelationAttributeInstance_nullName_message());
338 this.typeId = typeId;
339 this.displayName = displayName;
340 this.dbTableName = dbTableName;
341 this.supported = supported;
342 this.enabled = enabled;
343 if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
344 throw new CentralRepoException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.", Bundle.CorrelationAttributeInstance_invalidName_message());
362 this(-1, displayName, dbTableName, supported, enabled);
392 return this.typeId == that.getId()
393 && Objects.equals(this.supported, that.isSupported())
394 && Objects.equals(
this.enabled, that.isEnabled());
400 hash = 67 * hash + Objects.hashCode(this.typeId);
401 hash = 67 * hash + Objects.hashCode(this.supported);
402 hash = 67 * hash + Objects.hashCode(this.enabled);
408 StringBuilder str =
new StringBuilder(55);
411 .append(
", displayName=")
412 .append(getDisplayName())
413 .append(
", dbTableName=")
414 .append(getDbTableName())
415 .append(
", supported=")
416 .append(isSupported().toString())
417 .append(
", enabled=")
418 .append(isEnabled().toString())
420 return str.toString();
434 this.typeId = typeId;
452 this.supported = supported;
470 this.enabled = enabled;
484 this.displayName = displayName;
527 if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
528 throw new CentralRepoException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.");
530 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)