All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jelastic.api.system.persistence.ExtDomain Maven / Gradle / Ivy

The newest version!
/*Server class MD5: b9eb3073e6cffc92eb48e858b5854e6f*/
package com.jelastic.api.system.persistence;

import com.jelastic.api.core.orm.dao.AbstractEntity;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.Objects;

/**
 * @name Jelastic API Client
 * @version 8.11.2
 * @copyright Jelastic, Inc.
 */
public class ExtDomain extends AbstractEntity implements Serializable, Cloneable {

    public static final String ID = "id";

    public static final String DOMAIN = "domain";

    public static final String SSL_CERT = "sslCert";

    public static final String SSL_ENABLED = "sslEnabled";

    private String domain;

    private boolean sslEnabled;

    private SSLCert sslCert;

    private AppNodes env;

    public ExtDomain() {
    }

    public ExtDomain(String domain) {
        this.domain = domain;
    }

    public ExtDomain(String domain, SSLCert sslCert) {
        this(domain);
        this.sslCert = sslCert;
        this.sslEnabled = true;
    }

    public void clearSSL() {
        sslCert = null;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public SSLCert getSslCert() {
        return sslCert;
    }

    public void setSslCert(SSLCert sslCert) {
        this.sslCert = sslCert;
    }

    public boolean isSslEnabled() {
        return sslEnabled;
    }

    public void setSslEnabled(boolean sslEnabled) {
        this.sslEnabled = sslEnabled;
    }

    public AppNodes getEnv() {
        return env;
    }

    public void setEnv(AppNodes env) {
        this.env = env;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        if (!super.equals(o))
            return false;
        ExtDomain domain1 = (ExtDomain) o;
        return Objects.equals(getId(), domain1.getId());
    }

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

    @Override
    protected Object clone() {
        return new ExtDomain(this.domain);
    }

    public JSONObject toJSON() throws JSONException {
        JSONObject json = new JSONObject();
        json.put(ID, getId());
        json.put(DOMAIN, domain);
        json.put(SSL_ENABLED, sslEnabled);
        return json;
    }

    public ExtDomain fromJSON(JSONObject json) throws JSONException {
        if (json.has(ID)) {
            setId(json.getInt(ID));
        }
        if (json.has(DOMAIN)) {
            this.domain = json.getString(DOMAIN);
        }
        if (json.has(SSL_ENABLED)) {
            this.sslEnabled = json.getBoolean(SSL_ENABLED);
        }
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy