[a51a591] | 1 | package com.example.model;
|
---|
| 2 |
|
---|
| 3 | import com.example.model.Enumerations.Role;
|
---|
| 4 | import lombok.Getter;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 |
|
---|
| 7 | import javax.persistence.*;
|
---|
| 8 | import java.util.List;
|
---|
| 9 |
|
---|
| 10 | @Getter
|
---|
| 11 | @Setter
|
---|
| 12 | @Entity
|
---|
| 13 | @Table(name = "klienti")
|
---|
| 14 | public class Client extends User {
|
---|
| 15 | @Column(name = "br_organizirani_nastani")
|
---|
| 16 | Integer number_events;
|
---|
| 17 |
|
---|
| 18 | @OneToMany(mappedBy = "client")
|
---|
| 19 | List<Event> event;
|
---|
| 20 |
|
---|
| 21 | @ManyToOne
|
---|
| 22 | @JoinColumn(name = "korisnik_id_keterinzi")
|
---|
| 23 | Catering catering_id;
|
---|
| 24 |
|
---|
| 25 | // @OneToMany(mappedBy = "client")
|
---|
| 26 | // List<Event> events;
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | public Client(String name, String username, String number, String password, Role role) {
|
---|
| 30 | super(name, username, number, password, role);
|
---|
| 31 | this.number_events = 0;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | public Client() {
|
---|
| 35 |
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | // @Override
|
---|
| 39 | // public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 40 | // return Collections.singletonList(Role.ROLE_CLIENT);
|
---|
| 41 | // }
|
---|
| 42 |
|
---|
| 43 | @Override
|
---|
| 44 | public String toString() {
|
---|
| 45 | return "Client{" +
|
---|
| 46 | "number_events=" + number_events +
|
---|
| 47 | ", event=" + event.toString() +
|
---|
| 48 | ", catering_id=" + catering_id +
|
---|
| 49 | ", id=" + id +
|
---|
| 50 | ", date=" + date +
|
---|
| 51 | ", name='" + name + '\'' +
|
---|
| 52 | ", username='" + username + '\'' +
|
---|
| 53 | ", password='" + password + '\'' +
|
---|
| 54 | ", number='" + number + '\'' +
|
---|
| 55 | '}';
|
---|
| 56 | }
|
---|
| 57 | }
|
---|