source: src/main/java/com/example/model/Admin.java@ a51a591

Last change on this file since a51a591 was a51a591, checked in by colovik <j.colovik@…>, 14 months ago

final

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[a51a591]1package com.example.model;
2
3import com.example.model.Enumerations.Role;
4import lombok.Getter;
5import lombok.Setter;
6import org.hibernate.Hibernate;
7
8import javax.persistence.Column;
9import javax.persistence.Entity;
10import javax.persistence.OneToMany;
11import javax.persistence.Table;
12import java.util.List;
13import java.util.Objects;
14
15@Getter
16@Setter
17@Entity
18@Table(name = "admini")
19public class Admin extends User{
20
21 @Column(name = "br_organizirani_nastani")
22 Integer number_events;
23
24 @OneToMany(mappedBy = "admin")
25 List<Event> events;
26
27 public Admin(String name, String username, String number, String password, Role role) {
28 super(name, username, number, password, role);
29 this.number_events = 0;
30 }
31
32 public Admin() {
33 }
34
35// @Override
36// public Collection<? extends GrantedAuthority> getAuthorities() {
37// return Collections.singletonList(Role.ROLE_ADMIN);
38// }
39
40 @Override
41 public boolean equals(Object o) {
42 if (this == o) return true;
43 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
44 Admin that = (Admin) o;
45 return id != null && Objects.equals(id, that.id);
46 }
47
48 @Override
49 public String toString() {
50 return "Admin{" +
51 "number_events=" + number_events +
52 ", events=" + events.toString() +
53 ", id=" + id +
54 ", date=" + date +
55 ", name='" + name + '\'' +
56 ", username='" + username + '\'' +
57 ", password='" + password + '\'' +
58 ", number='" + number + '\'' +
59 '}';
60 }
61}
Note: See TracBrowser for help on using the repository browser.