<commit_before>package stroom.search.elastic.shared;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@XmlAccessorType(XmlAccessType.FIELD)
@JsonPropertyOrder({"connectionUrls,caCertificate,useAuthentication,apiKeyId,apiKeySecret,socketTimeoutMillis"})
@XmlRootElement(name = "connection")
@XmlType(name = "ElasticConnectionConfig", propOrder = {"connectionUrls", "caCertificate", "useAuthentication", "apiKeyId", "apiKeySecret", "socketTimeoutMillis"})
public class ElasticConnectionConfig implements Serializable {
    private List<String> connectionUrls = new ArrayList<>();

    /**
     * DER or PEM-encoded CA certificate for X.509 verification
     */
    private String caCertificate;

    private boolean useAuthentication = false;

    private String apiKeyId;

    /**
     * Plain-text API key (not serialised)
     */
    @JsonIgnore
    private String apiKeySecret;

    /**
     * This is the field that is actually serialised and is an encrypted version of member variable `apiKeySecret`
     */
    @JsonProperty("apiKeySecret")
    private String apiKeySecretEncrypted;

    /**
     * Socket timeout duration. Any Elasticsearch requests are expected to complete within this interval,
     * else the request is aborted and an `Error` is reported.
     */
    private int socketTimeoutMillis = -1;

    public List<String> getConnectionUrls() { return connectionUrls; }

    public void setConnectionUrls(final List<String> connectionUrls) { this.connectionUrls = connectionUrls; }

    public String getCaCertificate() { return caCertificate; }

    public void setCaCertificate(final String caCertificate) { this.caCertificate = caCertificate; }

    public boolean getUseAuthentication() { return useAuthentication; }

    public void setUseAuthentication(final boolean useAuthentication) { this.useAuthentication = useAuthentication; }

    public String getApiKeyId() { return apiKeyId; }

    public void setApiKeyId(final String apiKeyId) { this.apiKeyId = apiKeyId; }

    public String getApiKeySecret() { return apiKeySecret; }

    public void setApiKeySecret(final String apiKeySecret) { this.apiKeySecret = apiKeySecret; }

    public String getApiKeySecretEncrypted() { return apiKeySecretEncrypted; }

    public void setApiKeySecretEncrypted(final String apiKeySecretEncrypted) { this.apiKeySecretEncrypted = apiKeySecretEncrypted; }

    public int getSocketTimeoutMillis() { return socketTimeoutMillis; }

    public void setSocketTimeoutMillis(final int socketTimeoutMillis) { this.socketTimeoutMillis = socketTimeoutMillis; }

    @Override
    public boolean equals(final Object o) {
        if (this == o) return true;
        if (!(o instanceof ElasticConnectionConfig)) return false;
        final ElasticConnectionConfig that = (ElasticConnectionConfig)o;

        return Objects.equals(connectionUrls, that.connectionUrls) &&
                Objects.equals(caCertificate, that.caCertificate) &&
                Objects.equals(useAuthentication, that.useAuthentication) &&
                Objects.equals(apiKeyId, that.apiKeyId) &&
                Objects.equals(apiKeySecret, that.apiKeySecret) &&
                Objects.equals(socketTimeoutMillis, that.socketTimeoutMillis);
    }

    @Override
    public int hashCode() {
        return Objects.hash(connectionUrls);
    }

    @Override
    public String toString() {<commit_msg>Remove encrypted API key field<commit_after>package stroom.search.elastic.shared;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@XmlAccessorType(XmlAccessType.FIELD)
@JsonPropertyOrder({"connectionUrls,caCertificate,useAuthentication,apiKeyId,apiKeySecret,socketTimeoutMillis"})
@XmlRootElement(name = "connection")
@XmlType(name = "ElasticConnectionConfig", propOrder = {"connectionUrls", "caCertificate", "useAuthentication", "apiKeyId", "apiKeySecret", "socketTimeoutMillis"})
public class ElasticConnectionConfig implements Serializable {
    private List<String> connectionUrls = new ArrayList<>();

    /**
     * DER or PEM-encoded CA certificate for X.509 verification
     */
    private String caCertificate;

    private boolean useAuthentication = false;

    private String apiKeyId;

    /**
     * Plain-text API key (not serialised)
     */
    private String apiKeySecret;

    /**
     * Socket timeout duration. Any Elasticsearch requests are expected to complete within this interval,
     * else the request is aborted and an `Error` is reported.
     */
    private int socketTimeoutMillis = -1;

    public List<String> getConnectionUrls() { return connectionUrls; }

    public void setConnectionUrls(final List<String> connectionUrls) { this.connectionUrls = connectionUrls; }

    public String getCaCertificate() { return caCertificate; }

    public void setCaCertificate(final String caCertificate) { this.caCertificate = caCertificate; }

    public boolean getUseAuthentication() { return useAuthentication; }

    public void setUseAuthentication(final boolean useAuthentication) { this.useAuthentication = useAuthentication; }

    public String getApiKeyId() { return apiKeyId; }

    public void setApiKeyId(final String apiKeyId) { this.apiKeyId = apiKeyId; }

    public String getApiKeySecret() { return apiKeySecret; }

    public void setApiKeySecret(final String apiKeySecret) { this.apiKeySecret = apiKeySecret; }

    public int getSocketTimeoutMillis() { return socketTimeoutMillis; }

    public void setSocketTimeoutMillis(final int socketTimeoutMillis) { this.socketTimeoutMillis = socketTimeoutMillis; }

    @Override
    public boolean equals(final Object o) {
        if (this == o) return true;
        if (!(o instanceof ElasticConnectionConfig)) return false;
        final ElasticConnectionConfig that = (ElasticConnectionConfig)o;

        return Objects.equals(connectionUrls, that.connectionUrls) &&
                Objects.equals(caCertificate, that.caCertificate) &&
                Objects.equals(useAuthentication, that.useAuthentication) &&
                Objects.equals(apiKeyId, that.apiKeyId) &&
                Objects.equals(apiKeySecret, that.apiKeySecret) &&
                Objects.equals(socketTimeoutMillis, that.socketTimeoutMillis);
    }

    @Override
    public int hashCode() {
        return Objects.hash(connectionUrls);
    }

    @Override
    public String toString() {
{'fraction_non_alphanumeric': 0.08714751310755278, 'fraction_numerical': 0.0011336261867649143, 'mean_word_length': 4.208856088560886, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7492253', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1805, 'n_words': 466}