[850b344] | 1 | package com.project.beautycenter.model;
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | import org.springframework.security.core.GrantedAuthority;
|
---|
| 5 | import org.springframework.security.core.userdetails.UserDetails;
|
---|
| 6 |
|
---|
| 7 | import javax.persistence.*;
|
---|
| 8 | import java.util.Collection;
|
---|
| 9 |
|
---|
| 10 |
|
---|
| 11 | @Entity
|
---|
| 12 | @Table(name = "users", schema = "project", indexes = {
|
---|
| 13 | @Index(name = "users_username_key", columnList = "username", unique = true)
|
---|
| 14 | })
|
---|
| 15 | public class Users implements UserDetails {
|
---|
| 16 | @Id
|
---|
| 17 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 18 | @Column(name = "user_id", nullable = false)
|
---|
| 19 | private Integer id;
|
---|
| 20 |
|
---|
| 21 | @Column(name = "username", nullable = false, length = 100)
|
---|
| 22 | private String username;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "upassword", nullable = false, length = 100)
|
---|
| 25 | private String upassword;
|
---|
| 26 |
|
---|
| 27 | @OneToOne(fetch = FetchType.LAZY, mappedBy = "users")
|
---|
| 28 | private Vraboteni vraboteni;
|
---|
| 29 |
|
---|
| 30 | @OneToOne(fetch = FetchType.LAZY, mappedBy = "users")
|
---|
| 31 | private Klienti klienti;
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | public Klienti getKlienti() {
|
---|
| 35 | return klienti;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public void setKlienti(Klienti klienti) {
|
---|
| 39 | this.klienti = klienti;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | public Vraboteni getVraboteni() {
|
---|
| 43 | return vraboteni;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | public void setVraboteni(Vraboteni vraboteni) {
|
---|
| 47 | this.vraboteni = vraboteni;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public Users() {
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public Users(String username, String password) {
|
---|
| 54 | this.username = username;
|
---|
| 55 | this.upassword = password;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | @Override
|
---|
| 60 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 61 | return null;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public String getPassword() {
|
---|
| 65 | return upassword;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public void setUpassword(String upassword) {
|
---|
| 69 | this.upassword = upassword;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public String getUsername() {
|
---|
| 73 | return username;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | @Override
|
---|
| 77 | public boolean isAccountNonExpired() {
|
---|
| 78 | return true;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | @Override
|
---|
| 82 | public boolean isAccountNonLocked() {
|
---|
| 83 | return true;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | @Override
|
---|
| 87 | public boolean isCredentialsNonExpired() {
|
---|
| 88 | return true;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | @Override
|
---|
| 92 | public boolean isEnabled() {
|
---|
| 93 | return true;
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | public void setUsername(String username) {
|
---|
| 98 | this.username = username;
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | public Integer getId() {
|
---|
| 102 | return id;
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | public void setId(Integer id) {
|
---|
| 106 | this.id = id;
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | } |
---|