package com.project.beautycenter.model; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import javax.persistence.*; import java.util.Collection; @Entity @Table(name = "users", schema = "project", indexes = { @Index(name = "users_username_key", columnList = "username", unique = true) }) public class Users implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id", nullable = false) private Integer id; @Column(name = "username", nullable = false, length = 100) private String username; @Column(name = "upassword", nullable = false, length = 100) private String upassword; @OneToOne(fetch = FetchType.LAZY, mappedBy = "users") private Vraboteni vraboteni; @OneToOne(fetch = FetchType.LAZY, mappedBy = "users") private Klienti klienti; public Klienti getKlienti() { return klienti; } public void setKlienti(Klienti klienti) { this.klienti = klienti; } public Vraboteni getVraboteni() { return vraboteni; } public void setVraboteni(Vraboteni vraboteni) { this.vraboteni = vraboteni; } public Users() { } public Users(String username, String password) { this.username = username; this.upassword = password; } @Override public Collection getAuthorities() { return null; } public String getPassword() { return upassword; } public void setUpassword(String upassword) { this.upassword = upassword; } public String getUsername() { return username; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } public void setUsername(String username) { this.username = username; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } }