1 | package com.tourMate.dto;
|
---|
2 |
|
---|
3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
4 | import com.tourMate.entities.Transport;
|
---|
5 | import com.tourMate.entities.TransportRoute;
|
---|
6 | import jakarta.persistence.Temporal;
|
---|
7 | import jakarta.persistence.TemporalType;
|
---|
8 |
|
---|
9 | import java.util.Collection;
|
---|
10 | import java.util.Date;
|
---|
11 |
|
---|
12 | public class RouteListingDto {
|
---|
13 | private long transportAvailibleId;
|
---|
14 | private String from;
|
---|
15 | private String to;
|
---|
16 | private Date date;
|
---|
17 | private int freeSpace;
|
---|
18 | private Date time;
|
---|
19 | private Collection<String> routes;
|
---|
20 |
|
---|
21 | public RouteListingDto(long transportAvailibleId, String from, String to, Date date, int freeSpace, Date time, Collection<TransportRoute> routes) {
|
---|
22 | this.transportAvailibleId = transportAvailibleId;
|
---|
23 | this.from = from;
|
---|
24 | this.to = to;
|
---|
25 | this.date = date;
|
---|
26 | this.freeSpace = freeSpace;
|
---|
27 | this.time = time;
|
---|
28 | this.routes = routes.stream().map(x -> x.getFrom()).distinct().skip(1).toList();
|
---|
29 | }
|
---|
30 |
|
---|
31 | public long getTransportAvailibleId() {
|
---|
32 | return transportAvailibleId;
|
---|
33 | }
|
---|
34 |
|
---|
35 | public void setTransportAvailibleId(long transportAvailibleId) {
|
---|
36 | this.transportAvailibleId = transportAvailibleId;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public String getFrom() {
|
---|
40 | return from;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public void setFrom(String from) {
|
---|
44 | this.from = from;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public String getTo() {
|
---|
48 | return to;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public void setTo(String to) {
|
---|
52 | this.to = to;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public Date getDate() {
|
---|
56 | return date;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public void setDate(Date date) {
|
---|
60 | this.date = date;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public int getFreeSpace() {
|
---|
64 | return freeSpace;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public void setFreeSpace(int freeSpace) {
|
---|
68 | this.freeSpace = freeSpace;
|
---|
69 | }
|
---|
70 |
|
---|
71 | public Date getTime() {
|
---|
72 | return time;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public void setTime(Date time) {
|
---|
76 | this.time = time;
|
---|
77 | }
|
---|
78 |
|
---|
79 | public Collection<String> getRoutes() {
|
---|
80 | return routes;
|
---|
81 | }
|
---|
82 |
|
---|
83 | public void setRoutes(Collection<String> routes) {
|
---|
84 | this.routes = routes;
|
---|
85 | }
|
---|
86 | }
|
---|