InstallData.java

/*
 * Copyright © 2024-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.catalogue;

import java.time.LocalDateTime;

import org.ctan.site.domain.AbstractEntity;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * This domain class represents the log entry for a successful installation of a
 * package. All installations are kept as history.
 *
 * @author <a href="mailto:gene@ctan.org">Gerd Neugebauer</a>
 */
@Entity
@Data
@EqualsAndHashCode(callSuper = false)
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@SuppressFBWarnings(value = "EI_EXPOSE_REP")
public class InstallData extends AbstractEntity {

    /**
     * The field <code>id</code> contains the numerical id.
     */
    @Id
    @GeneratedValue
    @EqualsAndHashCode.Exclude
    private Long id;

    /**
     * The field <code>pkg</code> contains the package name.
     */
    @Column(length = 64)
    private String pkg;

    /**
     * The field <code>installationDate</code> contains the installation date at
     * CTAN.
     */
    @Column(name = "installation_date")
    private LocalDateTime installationDate;

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

        return String.format("%s %tF", pkg, installationDate);
    }
}