Last change
on this file since 2c7a732 was d7f5da9, checked in by milamihajlovska <mila.mihajlovska01@…>, 22 months ago |
changes for login (not working)
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | package com.example.moviezone.model;
|
---|
2 |
|
---|
3 | import javax.persistence.*;
|
---|
4 | import lombok.Getter;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.springframework.security.core.GrantedAuthority;
|
---|
8 |
|
---|
9 | import java.time.LocalDate;
|
---|
10 | import java.util.Collection;
|
---|
11 | import java.util.Collections;
|
---|
12 | import java.util.Objects;
|
---|
13 |
|
---|
14 | @Entity
|
---|
15 | @Getter
|
---|
16 | @Setter
|
---|
17 | @ToString
|
---|
18 | @Table(name = "workers")
|
---|
19 | @PrimaryKeyJoinColumn(name = "id_worker")
|
---|
20 | public class Worker extends User {
|
---|
21 |
|
---|
22 | String position;
|
---|
23 |
|
---|
24 | String work_hours_from;
|
---|
25 | String work_hours_to;
|
---|
26 |
|
---|
27 | @ManyToOne
|
---|
28 | @JoinColumn(name = "id_cinema")
|
---|
29 | Cinema cinema;
|
---|
30 |
|
---|
31 | public Worker(String password, String first_name, String last_name, String address, String contact_number, String username) {
|
---|
32 | super(password, first_name, last_name, address, contact_number, username);
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public boolean equals(Object o) {
|
---|
37 | if (this == o) return true;
|
---|
38 | if (o == null || getClass() != o.getClass()) return false;
|
---|
39 | Worker worker = (Worker) o;
|
---|
40 | return id_user!=null && Objects.equals(id_user, worker.id_user);
|
---|
41 | }
|
---|
42 |
|
---|
43 | @Override
|
---|
44 | public int hashCode() {
|
---|
45 | return Objects.hash();
|
---|
46 | }
|
---|
47 |
|
---|
48 | public Worker() {
|
---|
49 |
|
---|
50 | }
|
---|
51 |
|
---|
52 | @Override
|
---|
53 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
54 | return Collections.singletonList(Role.ROLE_ADMIN);
|
---|
55 | }
|
---|
56 |
|
---|
57 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.