/** * */ package de.bstly.board.model; import java.util.List; import java.util.Map; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.google.common.collect.Maps; /** * The Class LocalUser. */ @Entity @Table(name = "users") @JsonInclude(Include.NON_EMPTY) public class LocalUser { @Id @Column(name = "username", nullable = false) private String username; @Column(name = "external_id", nullable = true) private String externalId; @JsonIgnore @Column(name = "password_hash", nullable = true) private String passwordHash; @ElementCollection @LazyCollection(LazyCollectionOption.FALSE) @CollectionTable(name = "users_roles") private List roles; @Lob @Column(name = "about", nullable = true) private String about; @Column(name = "email", nullable = true) private String email; @Column(name = "locale", nullable = false, columnDefinition = "varchar(255) default 'en'") private String locale; @Column(name = "dark_theme", columnDefinition = "boolean default false") private boolean darkTheme; @ElementCollection @LazyCollection(LazyCollectionOption.FALSE) @CollectionTable(name = "users_settings") private Map settings; @Transient private Map metadata; /** * Gets the username. * * @return the username */ public String getUsername() { return username; } /** * Sets the username. * * @param username the new username */ public void setUsername(String username) { this.username = username; } /** * Gets the external id. * * @return the external id */ public String getExternalId() { return externalId; } /** * Sets the external id. * * @param externalId the new external id */ public void setExternalId(String externalId) { this.externalId = externalId; } /** * Gets the password hash. * * @return the password hash */ public String getPasswordHash() { return passwordHash; } /** * Sets the password hash. * * @param passwordHash the new password hash */ public void setPasswordHash(String passwordHash) { this.passwordHash = passwordHash; } /** * Gets the roles. * * @return the roles */ public List getRoles() { return roles; } /** * Sets the roles. * * @param roles the new roles */ public void setRoles(List roles) { this.roles = roles; } /** * Gets the about. * * @return the about */ public String getAbout() { return about; } /** * Sets the about. * * @param about the new about */ public void setAbout(String about) { this.about = about; } /** * Gets the email. * * @return the email */ public String getEmail() { return email; } /** * Sets the email. * * @param email the new email */ public void setEmail(String email) { this.email = email; } /** * Gets the locale. * * @return the locale */ public String getLocale() { return locale; } /** * Sets the locale. * * @param locale the new locale */ public void setLocale(String locale) { this.locale = locale; } /** * Checks if is dark theme. * * @return true, if is dark theme */ public boolean isDarkTheme() { return darkTheme; } /** * Sets the dark theme. * * @param darkTheme the new dark theme */ public void setDarkTheme(boolean darkTheme) { this.darkTheme = darkTheme; } /** * Gets the settings. * * @return the settings */ public Map getSettings() { return settings; } /** * Sets the settings. * * @param settings the settings */ public void setSettings(Map settings) { this.settings = settings; } /** * Gets the metadata. * * @return the metadata */ public Map getMetadata() { if (metadata == null) { metadata = Maps.newHashMap(); } return metadata; } /** * Sets the metadata. * * @param metadata the metadata */ public void setMetadata(Map metadata) { this.metadata = metadata; } }