2021-10-03 17:17:00 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
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;
|
|
|
|
|
2021-10-04 13:02:40 +02:00
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* The Class LocalUser.
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
@Entity
|
|
|
|
@Table(name = "users")
|
|
|
|
@JsonInclude(Include.NON_EMPTY)
|
|
|
|
public class LocalUser {
|
|
|
|
|
2021-10-04 13:02:40 +02:00
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Id
|
|
|
|
@Column(name = "username", nullable = false)
|
|
|
|
private String username;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Column(name = "external_id", nullable = true)
|
|
|
|
private String externalId;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@JsonIgnore
|
|
|
|
@Column(name = "password_hash", nullable = true)
|
|
|
|
private String passwordHash;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@ElementCollection
|
|
|
|
@LazyCollection(LazyCollectionOption.FALSE)
|
|
|
|
@CollectionTable(name = "users_roles")
|
|
|
|
private List<String> roles;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Lob
|
|
|
|
@Column(name = "about", nullable = true)
|
|
|
|
private String about;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Column(name = "email", nullable = true)
|
|
|
|
private String email;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Column(name = "locale", nullable = false, columnDefinition = "varchar(255) default 'en'")
|
|
|
|
private String locale;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Column(name = "dark_theme", columnDefinition = "boolean default false")
|
|
|
|
private boolean darkTheme;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@ElementCollection
|
|
|
|
@LazyCollection(LazyCollectionOption.FALSE)
|
|
|
|
@CollectionTable(name = "users_settings")
|
|
|
|
private Map<String, String> settings;
|
2021-10-04 13:02:40 +02:00
|
|
|
|
|
|
|
|
2021-10-03 17:17:00 +02:00
|
|
|
@Transient
|
|
|
|
private Map<String, Object> metadata;
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the username.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the username
|
|
|
|
*/
|
|
|
|
public String getUsername() {
|
|
|
|
return username;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the username.
|
|
|
|
*
|
|
|
|
* @param username the new username
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setUsername(String username) {
|
|
|
|
this.username = username;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the external id.
|
|
|
|
*
|
|
|
|
* @return the external id
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public String getExternalId() {
|
|
|
|
return externalId;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the external id.
|
|
|
|
*
|
|
|
|
* @param externalId the new external id
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setExternalId(String externalId) {
|
|
|
|
this.externalId = externalId;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the password hash.
|
|
|
|
*
|
|
|
|
* @return the password hash
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public String getPasswordHash() {
|
|
|
|
return passwordHash;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the password hash.
|
|
|
|
*
|
|
|
|
* @param passwordHash the new password hash
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setPasswordHash(String passwordHash) {
|
|
|
|
this.passwordHash = passwordHash;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the roles.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the roles
|
|
|
|
*/
|
|
|
|
public List<String> getRoles() {
|
|
|
|
return roles;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the roles.
|
|
|
|
*
|
|
|
|
* @param roles the new roles
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setRoles(List<String> roles) {
|
|
|
|
this.roles = roles;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the about.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the about
|
|
|
|
*/
|
|
|
|
public String getAbout() {
|
|
|
|
return about;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the about.
|
|
|
|
*
|
|
|
|
* @param about the new about
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setAbout(String about) {
|
|
|
|
this.about = about;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the email.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the email
|
|
|
|
*/
|
|
|
|
public String getEmail() {
|
|
|
|
return email;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the email.
|
|
|
|
*
|
|
|
|
* @param email the new email
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setEmail(String email) {
|
|
|
|
this.email = email;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the locale.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the locale
|
|
|
|
*/
|
|
|
|
public String getLocale() {
|
|
|
|
return locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the locale.
|
|
|
|
*
|
|
|
|
* @param locale the new locale
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setLocale(String locale) {
|
|
|
|
this.locale = locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Checks if is dark theme.
|
|
|
|
*
|
|
|
|
* @return true, if is dark theme
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public boolean isDarkTheme() {
|
|
|
|
return darkTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the dark theme.
|
|
|
|
*
|
|
|
|
* @param darkTheme the new dark theme
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setDarkTheme(boolean darkTheme) {
|
|
|
|
this.darkTheme = darkTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the settings.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the settings
|
|
|
|
*/
|
|
|
|
public Map<String, String> getSettings() {
|
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the settings.
|
|
|
|
*
|
|
|
|
* @param settings the settings
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setSettings(Map<String, String> settings) {
|
|
|
|
this.settings = settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Gets the metadata.
|
|
|
|
*
|
2021-10-03 17:17:00 +02:00
|
|
|
* @return the metadata
|
|
|
|
*/
|
|
|
|
public Map<String, Object> getMetadata() {
|
|
|
|
if (metadata == null) {
|
|
|
|
metadata = Maps.newHashMap();
|
|
|
|
}
|
|
|
|
return metadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-10-04 13:02:40 +02:00
|
|
|
* Sets the metadata.
|
|
|
|
*
|
|
|
|
* @param metadata the metadata
|
2021-10-03 17:17:00 +02:00
|
|
|
*/
|
|
|
|
public void setMetadata(Map<String, Object> metadata) {
|
|
|
|
this.metadata = metadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|