Lug.java
/*
* Copyright © 2023-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.site;
import org.ctan.site.domain.AbstractEntity;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.persistence.AttributeOverride;
import jakarta.persistence.AttributeOverrides;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
/**
* The class <code>Lug</code> contains additional infos for the Local TeX User
* Groups.
*
* @author <a href="mailto:gene@ctan.org">Gerd Neugebauer</a>
*/
@Entity
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@SuppressFBWarnings(value = "EI_EXPOSE_REP")
public class Lug extends AbstractEntity {
/**
* The class <code>LugBank</code> contains bank data.
*/
@Embeddable
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class LugBank {
@Column(length = 32)
private String account;
@Column(length = 64)
private String name;
@Column(length = 32)
private String bic;
@Column(length = 32)
private String swift;
@Column(length = 256)
private String address;
}
/**
* The class <code>LugPeriodical</code> contains infos about the periodical
* publication.
*/
@Embeddable
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class LugPeriodical {
@Column(length = 64)
private String title;
@Column(length = 128)
private String editorName;
@Column(length = 128)
private String editorEmail;
}
/**
* The class <code>LugPosition</code> contains description of a person's
* role in the organisation.
*/
@Embeddable
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class LugPosition {
@Column(length = 128)
private String name;
@Column(length = 256)
private String address;
@Column(length = 128)
private String email;
@Column(length = 64)
private String phone;
@Column(length = 64)
private String fax;
@Column(length = 64)
private String position;
}
/**
* The field <code>code</code> contains the id of the LUG.
*/
@Column(length = 3)
private String code;
/**
* The field <code>country</code> contains the country code for the LUG.
*/
@Column(length = 8)
private String country;
/**
* The field <code>short_name</code> contains the short name or abbreviation
* of the LUG.
*/
@Column(length = 32, name = "short_name")
private String shortName;
/**
* The field <code>full_name</code> contains the long name of the LUG.
*/
@Column(length = 128, nullable = false, name = "full_name")
private String fullName;
/**
* The field <code>languages</code> contains the language codes supported by
* the LUG. Several languages are separated by comma.
*/
@Column(length = 32)
private String languages;
/**
* The field <code>email</code> contains the email address of the LUG. This
* value is optional
*/
@Column(length = 128)
private String email;
/**
* The field <code>website</code> contains the address of the LUG's Web
* site. This value is optional
*/
@Column(length = 256)
private String website;
/**
* The field <code>mailinglist</code> contains the email address of the
* LUG's mailing list. This value is optional
*/
@Column(length = 128)
private String mailinglist;
/**
* The field <code>mailinglistSubscribe</code> contains the email address
* where one can subscribe to the mailing list of the LUG. This value is
* optional
*/
@Column(length = 128, name = "mailinglist_subscribe")
private String mailinglistSubscribe;
/**
* The field <code>address</code> contains the postal address of the LUG.
* This value is optional
*/
@Column(length = 256)
private String address;
@Column(name = "number_of_members")
private int numberOfMembers;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "editorName",
column = @Column(name = "periodical_editor_name")),
@AttributeOverride(name = "editorEmail",
column = @Column(name = "periodical_editor_email")),
@AttributeOverride(name = "title",
column = @Column(name = "periodical_title"))})
@Default
private LugPeriodical periodical = new LugPeriodical();
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "name",
column = @Column(name = "bank_name")),
@AttributeOverride(name = "account",
column = @Column(name = "bank_account")),
@AttributeOverride(name = "address",
column = @Column(name = "bank_address")),
@AttributeOverride(name = "bic",
column = @Column(name = "bank_bic")),
@AttributeOverride(name = "swift",
column = @Column(name = "bank_swift"))})
@Default
private LugBank bank = new LugBank();
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "name",
column = @Column(name = "policy_name")),
@AttributeOverride(name = "email",
column = @Column(name = "policy_email")),
@AttributeOverride(name = "phone",
column = @Column(name = "policy_phone")),
@AttributeOverride(name = "fax",
column = @Column(name = "policy_fax")),
@AttributeOverride(name = "address",
column = @Column(name = "policy_address")),
@AttributeOverride(name = "position",
column = @Column(name = "policy_position"))})
@Default
private LugPosition policy = new LugPosition();
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "name",
column = @Column(name = "general_name")),
@AttributeOverride(name = "email",
column = @Column(name = "general_email")),
@AttributeOverride(name = "phone",
column = @Column(name = "general_phone")),
@AttributeOverride(name = "fax",
column = @Column(name = "general_fax")),
@AttributeOverride(name = "address",
column = @Column(name = "general_address")),
@AttributeOverride(name = "position",
column = @Column(name = "general_position"))})
@Default
private LugPosition general = new LugPosition();
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "name",
column = @Column(name = "financial_name")),
@AttributeOverride(name = "email",
column = @Column(name = "financial_email")),
@AttributeOverride(name = "phone",
column = @Column(name = "financial_phone")),
@AttributeOverride(name = "fax",
column = @Column(name = "financial_fax")),
@AttributeOverride(name = "address",
column = @Column(name = "financial_address")),
@AttributeOverride(name = "position",
column = @Column(name = "financial_position"))})
@Default
private LugPosition financial = new LugPosition();
// LocalDateTime lastUpdated
// static mapping = { autoTimestamp true }
/**
* {@inheritDoc}
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return shortName != null && !shortName.isBlank() ? shortName : fullName;
}
}