source: src/main/java/com/example/autopartz/model/Warehouseman.java@ ae042f4

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.2 KB
Line 
1package com.example.autopartz.model;
2
3import lombok.Getter;
4import lombok.RequiredArgsConstructor;
5import lombok.Setter;
6import lombok.ToString;
7import org.hibernate.Hibernate;
8import org.springframework.security.core.GrantedAuthority;
9
10import javax.persistence.Entity;
11import javax.persistence.JoinColumn;
12import javax.persistence.ManyToOne;
13import java.time.LocalDate;
14import java.util.Collection;
15import java.util.Collections;
16import java.util.Objects;
17
18@Getter
19@Setter
20@ToString
21@RequiredArgsConstructor
22@Entity
23public class Warehouseman extends User{
24 LocalDate employed_from;
25 @ManyToOne
26 @JoinColumn(name = "id_warehouse")
27 Warehouse warehouse;
28
29 @Override
30 public boolean equals(Object o) {
31 if (this == o) return true;
32 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
33 Warehouseman that = (Warehouseman) o;
34 return ID_user != null && Objects.equals(ID_user, that.ID_user);
35 }
36
37 @Override
38 public int hashCode() {
39 return getClass().hashCode();
40 }
41 @Override
42 public Collection<? extends GrantedAuthority> getAuthorities() {
43 return Collections.singletonList(Role.ROLE_WAREHOUSEMAN);
44 }
45}
Note: See TracBrowser for help on using the repository browser.