Blacklist.java
/*
* Copyright © 2024-2026 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 com.google.common.collect.ImmutableMap;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* The domain class <code>Blacklist</code> contains the description of a
* forbidden word for an account name or in the guest book of the site.
*
* @author <a href="mailto:gene@ctan.org">Gerd Neugebauer</a>
*/
@Entity
@Table(name = "blacklist")
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class Blacklist extends AbstractEntity {
/**
* The field <code>stopword</code> contains the forbidden word.
*/
@Column(length = 255, name = "word")
private String word;
/**
* The field <code>forAccount</code> contains the indicator that the stop
* word should be applied for account names.
*/
@Column(name = "for_account")
private boolean forAccount;
/**
* The field <code>forGuestbook</code> contains the indicator that the stop
* word should be applied to guest book entries.
*/
@Column(name = "for_guestbook")
private boolean forGuestbook;
/**
* The method <code>toMap</code> provides means to get the instance as an
* immutable Map.
*
* @return the Map
*/
public ImmutableMap<String, Object> toMap() {
return ImmutableMap.of("id", (Object) getId(),
"word", word,
"forAccount", forAccount,
"forGuestbook", forGuestbook);
}
}