19 package org.sleuthkit.autopsy.centralrepository.datamodel;
21 import java.util.Objects;
22 import java.util.regex.Pattern;
39 if (null == s || s.isEmpty())
44 if (!Pattern.matches(pattern, s))
49 if ((min != null && num < min) || (max != null && num > max))
115 validateStr(host,
"Invalid host name. Cannot be empty.");
125 validateNum(port, 1, 65535,
"Invalid port. Must be a number greater than 0.");
136 validateStr(dbName,
"Invalid database name. Cannot be empty.");
138 "Invalid database name. Name must start with a lowercase letter and can only contain lowercase letters, numbers, and '_'.");
140 this.dbName = dbName.toLowerCase();
149 validateNum(bulkThreshold, 1, null,
"Invalid bulk threshold.");
160 validateStr(userName,
"Invalid user name. Cannot be empty.");
162 "Invalid user name. Name must start with a letter and can only contain letters, numbers, and '_'.");
173 validateStr(password,
"Invalid user password. Cannot be empty.");
180 hash = 43 * hash + Objects.hashCode(this.host);
181 hash = 43 * hash + this.
port;
182 hash = 43 * hash + Objects.hashCode(this.dbName);
184 hash = 43 * hash + Objects.hashCode(this.userName);
185 hash = 43 * hash + Objects.hashCode(this.password);
198 if (getClass() != obj.getClass()) {
202 if (this.port != other.
port) {
208 if (!Objects.equals(
this.host, other.
host)) {
211 if (!Objects.equals(
this.dbName, other.
dbName)) {
214 if (!Objects.equals(
this.userName, other.
userName)) {
217 if (!Objects.equals(
this.password, other.
password)) {
void setPassword(String password)
boolean equals(Object obj)
static final String DEFAULT_DBNAME
static final String DB_USER_NAMES_REGEX
static final String DEFAULT_USERNAME
void setHost(String host)
void setDbName(String dbName)
static void validateNum(int num, Integer min, Integer max, String errMessage)
void setBulkThreshold(int bulkThreshold)
void setUserName(String userName)
static final String DEFAULT_PASSWORD
static void validateStr(String s, String errMessage)
static final String DB_NAMES_REGEX
static void validateRegex(String s, String pattern, String errMessage)
static final String DEFAULT_HOST
static final int DEFAULT_PORT