source: src/main/java/project/educatum/model/Student.java

Last change on this file was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 2.1 KB
Line 
1package project.educatum.model;
2
3import lombok.Data;
4import org.springframework.security.core.GrantedAuthority;
5import org.springframework.security.core.userdetails.UserDetails;
6import org.springframework.security.oauth2.core.user.OAuth2User;
7
8import javax.persistence.*;
9import java.util.Collection;
10import java.util.Map;
11
12@Data
13@Entity
14@Table(name = "ucenici", schema = "project")
15public class Student implements UserDetails {
16
17 @Id
18 @GeneratedValue(strategy = GenerationType.IDENTITY)
19 @Column(name = "id_ucenik", nullable = false)
20 private Integer id;
21
22 @Column(name = "opis", length = 500)
23 private String description;
24
25 @Column(name = "ime", nullable = false, length = 50)
26 private String name;
27
28 @Column(name = "prezime", nullable = false, length = 50)
29 private String surname;
30
31 @Column(name = "email", nullable = false, length = 50)
32 private String email;
33
34 @Column(name = "password", nullable = false, length = 300)
35 private String password;
36
37 @Column(name = "telefonski_broj", length = 15)
38 private String telephoneNumber;
39
40 public Student() {
41 }
42
43 public Student(String description, String name, String surname, String email, String password, String telephoneNumber) {
44 this.description = description;
45 this.name = name;
46 this.surname = surname;
47 this.email = email;
48 this.password = password;
49 this.telephoneNumber = telephoneNumber;
50 }
51
52
53 @Override
54 public Collection<? extends GrantedAuthority> getAuthorities() {
55 return null;
56 }
57
58 public String getPassword() {
59 return password;
60 }
61
62 @Override
63 public String getUsername() {
64 return email;
65 }
66
67 @Override
68 public boolean isAccountNonExpired() {
69 return false;
70 }
71
72 @Override
73 public boolean isAccountNonLocked() {
74 return false;
75 }
76
77 @Override
78 public boolean isCredentialsNonExpired() {
79 return false;
80 }
81
82 @Override
83 public boolean isEnabled() {
84 return true;
85 }
86
87 public String getFullName() {
88 return name + ' ' + surname;
89 }
90
91}
Note: See TracBrowser for help on using the repository browser.