MirrorRegistration.java

/*
 * Copyright © 2012-2025 The CTAN Team and individual authors
 *
 * This file is distributed under the 3-clause BSD license.
 * See file LICENSE for details.
 */
package org.ctan.site.domain.mirrors;

import java.time.LocalDateTime;

import org.ctan.site.domain.AbstractEntity;
import org.hibernate.annotations.CreationTimestamp;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

/**
 * This domain class represents a registration request for a CTAN mirror.
 *
 * @author <a href="mailto:gene@ctan.org">Gerd Neugebauer</a>
 */
@Entity
@Table(name = "mirror_registration")
@SuperBuilder(toBuilder = true)
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuppressFBWarnings(value = "EI_EXPOSE_REP")
public class MirrorRegistration extends AbstractEntity {

    /**
     * The field <code>name</code> contains the host name.
     */
    @Column(length = 128, nullable = false)
    private String name;

    /**
     * The field <code>contactName</code> contains the name of the contact
     * person.
     */
    @Column(name = "contact_name", length = 128, nullable = false)
    private String contactName;

    /**
     * The field <code>contactEmail</code> contains the email of the contact
     * person.
     */
    @Column(name = "contact_email", length = 128, nullable = false)
    private String contactEmail;

    /**
     * The field <code>country</code> contains the country.
     */
    @Column(length = 128, nullable = false)
    private String country;

    /**
     * The field <code>region</code> contains the region.
     */
    @Column(length = 128)
    private String region;

    /**
     * The field <code>location</code> contains the location, i.e. the town.
     */
    @Column(length = 128)
    private String location;

    /**
     * The field <code>mirrorsFrom</code> contains the master host which is
     * mirrored.
     */
    @Column(name = "mirrors_from", length = 128)
    private String mirrorsFrom;

    /**
     * The field <code>httpsAddress</code> contains the HTTPS address or null.
     */
    @Column(name = "https_address", length = 128)
    private String httpsAddress;

    /**
     * The field <code>httpAddress</code> contains the HTTP address or null.
     */
    @Column(name = "http_address", length = 128)
    private String httpAddress;

    /**
     * The field <code>ftpAddress</code> contains the FTP address or null.
     */
    @Column(name = "ftp_address", length = 128)
    private String ftpAddress;

    /**
     * The field <code>rsyncAddress</code> contains the rsync address or null.
     */
    @Column(name = "rsync_address", length = 128)
    private String rsyncAddress;

    /**
     * The field <code>notes</code> contains optional notes.
     */
    @Column(length = 4096, nullable = true)
    private String notes;

    /**
     * The field <code>dateCreated</code> contains the creation date.
     */
    @Column(name = "date_created")
    @CreationTimestamp
    private LocalDateTime dateCreated;

    /**
     * {@inheritDoc}
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {

        return name;
    }
}