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;
54 @Messages({
"CorrelationType.FILES.displayName=Files",
55 "CorrelationType.DOMAIN.displayName=Domains",
56 "CorrelationType.EMAIL.displayName=Email Addresses",
57 "CorrelationType.PHONE.displayName=Phone Numbers",
58 "CorrelationType.USBID.displayName=USB Devices"})
61 DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttribute.
Type(FILES_TYPE_ID, Bundle.CorrelationType_FILES_displayName(),
"file",
true,
true));
62 DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttribute.
Type(DOMAIN_TYPE_ID, Bundle.CorrelationType_DOMAIN_displayName(),
"domain",
true,
false));
63 DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttribute.
Type(EMAIL_TYPE_ID, Bundle.CorrelationType_EMAIL_displayName(),
"email_address",
true,
false));
64 DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttribute.
Type(PHONE_TYPE_ID, Bundle.CorrelationType_PHONE_displayName(),
"phone_number",
true,
false));
65 DEFAULT_CORRELATION_TYPES.add(
new CorrelationAttribute.
Type(USBID_TYPE_ID, Bundle.CorrelationType_USBID_displayName(),
"usb_devices",
true,
false));
66 return DEFAULT_CORRELATION_TYPES;
73 this.correlationValue = correlationValue.toLowerCase();
74 this.artifactInstances =
new ArrayList<>();
88 String result = this.
getID()
91 result = this.
getInstances().stream().map((inst) -> inst.toString()).reduce(result, String::concat);
121 this.correlationValue = correlationValue.toLowerCase();
149 public void setInstances(List<CorrelationAttributeInstance> artifactInstances) {
150 this.artifactInstances.clear();
151 if (null != artifactInstances) {
152 this.artifactInstances.addAll(artifactInstances);
160 this.artifactInstances.add(artifactInstance);
163 public static class Type implements Serializable {
182 public Type(
int id, String displayName, String dbTableName, Boolean supported, Boolean enabled)
throws EamDbException {
188 if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
189 throw new EamDbException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.");
205 public Type(String displayName, String dbTableName, Boolean supported, Boolean enabled)
throws EamDbException {
236 return this.
id == that.getId()
237 && Objects.equals(this.supported, that.isSupported())
238 && Objects.equals(
this.enabled, that.isEnabled());
244 hash = 67 * hash + Objects.hashCode(this.
id);
245 hash = 67 * hash + Objects.hashCode(this.supported);
246 hash = 67 * hash + Objects.hashCode(this.enabled);
252 StringBuilder str =
new StringBuilder();
253 str.append(
"(id=").append(
getId());
259 return str.toString();
364 if (!Pattern.matches(DB_NAMES_REGEX, dbTableName)) {
365 throw new EamDbException(
"Invalid database table name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.");
String getCorrelationValue()
CorrelationAttribute(Type correlationType, String correlationValue)
static final int PHONE_TYPE_ID
Type getCorrelationType()
static final int FILES_TYPE_ID
Type(int id, String displayName, String dbTableName, Boolean supported, Boolean enabled)
Boolean equals(CorrelationAttribute otherArtifact)
void setEnabled(Boolean enabled)
void setInstances(List< CorrelationAttributeInstance > artifactInstances)
static final int EMAIL_TYPE_ID
void addInstance(CorrelationAttributeInstance artifactInstance)
void setCorrelationValue(String correlationValue)
Type(String displayName, String dbTableName, Boolean supported, Boolean enabled)
boolean sameType(CorrelationAttribute.Type that)
static final long serialVersionUID
void setDbTableName(String dbTableName)
void setCorrelationType(Type correlationType)
boolean equals(Object that)
List< CorrelationAttributeInstance > getInstances()
final String DB_NAMES_REGEX
static final int DOMAIN_TYPE_ID
static List< CorrelationAttribute.Type > getDefaultCorrelationTypes()
void setSupported(Boolean supported)
void setDisplayName(String displayName)
static final int USBID_TYPE_ID
final List< CorrelationAttributeInstance > artifactInstances