1 | package com.example.model;
|
---|
2 |
|
---|
3 | import com.example.model.Enumerations.Role;
|
---|
4 | import lombok.Data;
|
---|
5 | import org.hibernate.Hibernate;
|
---|
6 |
|
---|
7 | import javax.persistence.*;
|
---|
8 | import java.util.List;
|
---|
9 | import java.util.Objects;
|
---|
10 |
|
---|
11 | @Data
|
---|
12 | @Entity
|
---|
13 | @Table(name = "kelneri")
|
---|
14 | public class Waiter extends User{
|
---|
15 |
|
---|
16 | @Column(name = "slobodni_denovi")
|
---|
17 | Integer free_day;
|
---|
18 |
|
---|
19 | @Column(name = "god_iskustvo")
|
---|
20 | Integer experience;
|
---|
21 |
|
---|
22 | @ManyToOne
|
---|
23 | @JoinColumn(name = "korisnik_id_keterinzi")
|
---|
24 | Catering catering;
|
---|
25 |
|
---|
26 | @ManyToMany(mappedBy = "waiterList")
|
---|
27 | List<Event> eventList;
|
---|
28 |
|
---|
29 | public Waiter(String name, String username, String number, String password, Integer free_day,
|
---|
30 | Integer experience, Catering catering, Role role) {
|
---|
31 | super(name, username, number, password, role);
|
---|
32 | this.free_day = free_day;
|
---|
33 | this.experience = experience;
|
---|
34 | this.catering = catering;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public Waiter() {
|
---|
38 | }
|
---|
39 |
|
---|
40 | // @Override
|
---|
41 | // public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
42 | // return Collections.singletonList(Role.ROLE_WAITER);
|
---|
43 | // }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public boolean equals(Object o) {
|
---|
47 | if (this == o) return true;
|
---|
48 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
49 | Waiter that = (Waiter) o;
|
---|
50 | return id != null && Objects.equals(id, that.id);
|
---|
51 | }
|
---|
52 | }
|
---|