source: src/main/java/com/example/eatys_app/model/Korisnik.java

Last change on this file was b3f2adb, checked in by Aleksandar Siljanoski <acewow3@…>, 14 months ago

Adding project to repo

  • Property mode set to 100644
File size: 2.2 KB
Line 
1package com.example.eatys_app.model;
2
3
4import jakarta.persistence.*;
5import org.springframework.security.core.GrantedAuthority;
6import org.springframework.security.core.authority.SimpleGrantedAuthority;
7import org.springframework.security.core.userdetails.UserDetails;
8
9import java.util.Collection;
10import java.util.HashSet;
11import java.util.Set;
12
13
14@Inheritance(strategy = InheritanceType.JOINED)
15@Entity
16@Table(name="korisnik", schema = "project")
17public class Korisnik implements UserDetails {
18
19 @Id
20 @GeneratedValue(strategy = GenerationType.IDENTITY)
21 @Column(name = "user_id", nullable = false)
22 private Integer id;
23
24 @Column(name = "user_ime")
25 private String ime;
26
27 @Column(name = "user_prezime")
28 private String prezime;
29
30 @Column(name = "user_password")
31 private String password;
32
33
34
35
36// @Column(name = "user_admin_id", nullable = false)
37// private Integer admin_id;
38
39
40 public Korisnik() {
41 }
42
43 public Korisnik(String ime, String prezime, String password) {
44 this.ime = ime;
45 this.prezime = prezime;
46 this.password = password;
47 }
48
49 public Integer getId() {
50 return id;
51 }
52
53 public void setId(Integer id) {
54 this.id = id;
55 }
56
57 public String getIme() {
58 return ime;
59 }
60
61 public void setIme(String ime) {
62 this.ime = ime;
63 }
64
65 public String getPrezime() {
66 return prezime;
67 }
68
69 public void setPrezime(String prezime) {
70 this.prezime = prezime;
71 }
72
73 @Override
74 public Collection<? extends GrantedAuthority> getAuthorities() {
75 return new HashSet<GrantedAuthority>();
76 }
77
78 public String getPassword() {
79 return password;
80 }
81
82 @Override
83 public String getUsername() {
84 return ime;
85 }
86
87 @Override
88 public boolean isAccountNonExpired() {
89 return true;
90 }
91
92 @Override
93 public boolean isAccountNonLocked() {
94 return true;
95 }
96
97 @Override
98 public boolean isCredentialsNonExpired() {
99 return true;
100 }
101
102 @Override
103 public boolean isEnabled() {
104 return true;
105 }
106
107 public void setPassword(String password) {
108 this.password = password;
109 }
110
111
112}
Note: See TracBrowser for help on using the repository browser.