130 lines
2.2 KiB
Java
130 lines
2.2 KiB
Java
package de.tavolio.realm.user;
|
|
|
|
import de.tavolio.realm.RealmScoped;
|
|
import de.tavolio.realm.code.CodeEntity;
|
|
import de.tavolio.realm.RealmEntity;
|
|
import jakarta.persistence.*;
|
|
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Table(name = "user_regular")
|
|
public class UserEntity implements RealmScoped
|
|
{
|
|
@Id
|
|
private String id;
|
|
|
|
private String firstname;
|
|
|
|
private String lastname;
|
|
|
|
private String email;
|
|
|
|
@Column(name = "account_password")
|
|
private String password;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
private UserStatus status;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "realm_id")
|
|
private RealmEntity realm;
|
|
|
|
@OneToMany(mappedBy = "account")
|
|
private List<CodeEntity> codes;
|
|
|
|
public static UserEntity init()
|
|
{
|
|
return new UserEntity().setId(UUID.randomUUID().toString());
|
|
}
|
|
|
|
public String getId()
|
|
{
|
|
return id;
|
|
}
|
|
|
|
public UserEntity setId(String id)
|
|
{
|
|
this.id = id;
|
|
return this;
|
|
}
|
|
|
|
public String getFirstname()
|
|
{
|
|
return firstname;
|
|
}
|
|
|
|
public UserEntity setFirstname(String firstname)
|
|
{
|
|
this.firstname = firstname;
|
|
return this;
|
|
}
|
|
|
|
public String getLastname()
|
|
{
|
|
return lastname;
|
|
}
|
|
|
|
public UserEntity setLastname(String lastname)
|
|
{
|
|
this.lastname = lastname;
|
|
return this;
|
|
}
|
|
|
|
public String getEmail()
|
|
{
|
|
return email;
|
|
}
|
|
|
|
public UserEntity setEmail(String email)
|
|
{
|
|
this.email = email;
|
|
return this;
|
|
}
|
|
|
|
public String getPassword()
|
|
{
|
|
return password;
|
|
}
|
|
|
|
public UserEntity setPassword(String password)
|
|
{
|
|
this.password = password;
|
|
return this;
|
|
}
|
|
|
|
public UserStatus getStatus()
|
|
{
|
|
return status;
|
|
}
|
|
|
|
public UserEntity setStatus(UserStatus status)
|
|
{
|
|
this.status = status;
|
|
return this;
|
|
}
|
|
|
|
public RealmEntity getRealm()
|
|
{
|
|
return realm;
|
|
}
|
|
|
|
public UserEntity setRealm(RealmEntity realm)
|
|
{
|
|
this.realm = realm;
|
|
return this;
|
|
}
|
|
|
|
public List<CodeEntity> getCodes()
|
|
{
|
|
return codes;
|
|
}
|
|
|
|
public UserEntity setCodes(List<CodeEntity> codes)
|
|
{
|
|
this.codes = codes;
|
|
return this;
|
|
}
|
|
}
|