Changeset 7d43957 for src/main/java/com/example/autopartz/model
- Timestamp:
- 01/05/23 01:31:58 (23 months ago)
- Branches:
- main
- Children:
- 676144b
- Parents:
- ab952ab
- Location:
- src/main/java/com/example/autopartz/model
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/model/Client.java
rab952ab r7d43957 19 19 @Entity 20 20 public class Client extends User{ 21 public Client(String username, String name, String email, String password, String number) { 22 super(username, name, email, password, number); 23 } 24 21 25 @Override 22 26 public boolean equals(Object o) { -
src/main/java/com/example/autopartz/model/Deliveryman.java
rab952ab r7d43957 23 23 public class Deliveryman extends User{ 24 24 LocalDate employed_from; 25 public static final LocalDate defaultEmployedFrom = LocalDate.of(2020,1,1); 26 27 public Deliveryman(String username, String name, String email, String password, String number) { 28 super(username, name, email, password, number); 29 this.employed_from = defaultEmployedFrom; 30 } 25 31 26 32 @Override … … 38 44 @Override 39 45 public Collection<? extends GrantedAuthority> getAuthorities() { 40 return Collections.singletonList(Role.ROLE_DELIVERYMAN); 46 if(Objects.equals(employed_from, defaultEmployedFrom)) 47 return Collections.singletonList(Role.ROLE_PENDING_DELIVERYMAN); 48 else 49 return Collections.singletonList(Role.ROLE_DELIVERYMAN); 41 50 } 42 51 } -
src/main/java/com/example/autopartz/model/Order.java
rab952ab r7d43957 20 20 public class Order { 21 21 @Id 22 @GeneratedValue(strategy = GenerationType.IDENTITY) 22 23 Integer ID_order; 23 24 String order_status; … … 32 33 @ToString.Exclude 33 34 List<Part> partList; 35 36 public Order(Client user) { 37 this.order_status = "created"; 38 this.user = user; 39 this.order_date = LocalDateTime.now(); 40 } 34 41 35 42 @Override -
src/main/java/com/example/autopartz/model/Repair.java
rab952ab r7d43957 7 7 import org.hibernate.Hibernate; 8 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 9 import javax.persistence.*; 13 10 import java.util.Objects; 14 11 … … 21 18 @Id 22 19 Integer ID_repair; 23 @ ManyToOne24 @JoinColumn(name = " vin")25 CarSample carSample;20 @OneToOne 21 @JoinColumn(name = "id_order") 22 Order order; 26 23 @ManyToOne 27 24 @JoinColumn(name = "id_repair_shop") -
src/main/java/com/example/autopartz/model/Role.java
rab952ab r7d43957 6 6 public enum Role implements GrantedAuthority { 7 7 8 ROLE_USER,ROLE_CLIENT, ROLE_ADMIN, ROLE_WAREHOUSEMAN, ROLE_DELIVERYMAN ;8 ROLE_USER,ROLE_CLIENT, ROLE_ADMIN, ROLE_WAREHOUSEMAN, ROLE_DELIVERYMAN, ROLE_PENDING_WAREHOUSEMAN,ROLE_PENDING_DELIVERYMAN; 9 9 10 10 @Override -
src/main/java/com/example/autopartz/model/User.java
rab952ab r7d43957 24 24 public class User implements UserDetails { 25 25 @Id 26 @GeneratedValue(strategy = GenerationType.IDENTITY) 26 27 Integer ID_user; 27 28 String username; -
src/main/java/com/example/autopartz/model/Warehouse.java
rab952ab r7d43957 7 7 import org.hibernate.Hibernate; 8 8 9 import javax.persistence.Column; 9 10 import javax.persistence.Entity; 10 11 import javax.persistence.Id; … … 19 20 @Id 20 21 Integer ID_warehouse; 21 String warehouse_location; 22 @Column(name = "warehouse_location") 23 String location; 22 24 23 25 @Override -
src/main/java/com/example/autopartz/model/Warehouseman.java
rab952ab r7d43957 23 23 public class Warehouseman extends User{ 24 24 LocalDate employed_from; 25 public static final LocalDate defaultEmployedFrom = LocalDate.of(2020,1,1); 25 26 @ManyToOne 26 27 @JoinColumn(name = "id_warehouse") 27 28 Warehouse warehouse; 29 30 public Warehouseman(String username, String name, String email, String password, String number, Warehouse warehouse) { 31 super(username, name, email, password, number); 32 this.employed_from=defaultEmployedFrom; 33 this.warehouse= warehouse; 34 } 28 35 29 36 @Override … … 41 48 @Override 42 49 public Collection<? extends GrantedAuthority> getAuthorities() { 43 return Collections.singletonList(Role.ROLE_WAREHOUSEMAN); 50 if(employed_from==defaultEmployedFrom) 51 return Collections.singletonList(Role.ROLE_PENDING_WAREHOUSEMAN); 52 else 53 return Collections.singletonList(Role.ROLE_WAREHOUSEMAN); 44 54 } 45 55 } -
src/main/java/com/example/autopartz/model/views/RepairsForUser.java
rab952ab r7d43957 33 33 @Id 34 34 String partname; 35 Integer vin;35 Integer orderid; 36 36 String rsname; 37 37 }
Note:
See TracChangeset
for help on using the changeset viewer.