main
Last change
on this file since ae042f4 was ae042f4, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago |
Configured spring security, changed spring version
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[2e46f06] | 1 | package com.example.autopartz.model;
|
---|
| 2 |
|
---|
[ae042f4] | 3 | import lombok.Getter;
|
---|
| 4 | import lombok.RequiredArgsConstructor;
|
---|
| 5 | import lombok.Setter;
|
---|
| 6 | import lombok.ToString;
|
---|
[2e46f06] | 7 | import org.hibernate.Hibernate;
|
---|
[ae042f4] | 8 | import org.springframework.security.core.GrantedAuthority;
|
---|
[2e46f06] | 9 |
|
---|
[ae042f4] | 10 | import javax.persistence.Entity;
|
---|
| 11 | import javax.persistence.Table;
|
---|
[2e46f06] | 12 | import java.time.LocalDate;
|
---|
[ae042f4] | 13 | import java.util.Collection;
|
---|
| 14 | import java.util.Collections;
|
---|
[2e46f06] | 15 | import java.util.Objects;
|
---|
| 16 |
|
---|
| 17 | @Getter
|
---|
| 18 | @Setter
|
---|
| 19 | @ToString
|
---|
| 20 | @RequiredArgsConstructor
|
---|
| 21 | @Entity
|
---|
| 22 | @Table(name = "delivery_man")
|
---|
| 23 | public class Deliveryman extends User{
|
---|
| 24 | LocalDate employed_from;
|
---|
| 25 |
|
---|
| 26 | @Override
|
---|
| 27 | public boolean equals(Object o) {
|
---|
| 28 | if (this == o) return true;
|
---|
| 29 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 30 | Deliveryman that = (Deliveryman) o;
|
---|
| 31 | return ID_user != null && Objects.equals(ID_user, that.ID_user);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | @Override
|
---|
| 35 | public int hashCode() {
|
---|
| 36 | return getClass().hashCode();
|
---|
| 37 | }
|
---|
[ae042f4] | 38 | @Override
|
---|
| 39 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
| 40 | return Collections.singletonList(Role.ROLE_DELIVERYMAN);
|
---|
| 41 | }
|
---|
[2e46f06] | 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.