[e6c2521] | 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;
|
---|
[07f4e8b] | 20 | private Double maxPrice;
|
---|
[e6c2521] | 21 |
|
---|
[07f4e8b] | 22 | public RouteListingDto(long transportAvailibleId, String from, String to, Date date, int freeSpace, Date time, Collection<TransportRoute> routes, Double maxPrice) {
|
---|
[e6c2521] | 23 | this.transportAvailibleId = transportAvailibleId;
|
---|
| 24 | this.from = from;
|
---|
| 25 | this.to = to;
|
---|
| 26 | this.date = date;
|
---|
| 27 | this.freeSpace = freeSpace;
|
---|
| 28 | this.time = time;
|
---|
| 29 | this.routes = routes.stream().map(x -> x.getFrom()).distinct().skip(1).toList();
|
---|
[07f4e8b] | 30 | this.maxPrice = maxPrice;
|
---|
[e6c2521] | 31 | }
|
---|
| 32 |
|
---|
| 33 | public long getTransportAvailibleId() {
|
---|
| 34 | return transportAvailibleId;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public void setTransportAvailibleId(long transportAvailibleId) {
|
---|
| 38 | this.transportAvailibleId = transportAvailibleId;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public String getFrom() {
|
---|
| 42 | return from;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public void setFrom(String from) {
|
---|
| 46 | this.from = from;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | public String getTo() {
|
---|
| 50 | return to;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public void setTo(String to) {
|
---|
| 54 | this.to = to;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | public Date getDate() {
|
---|
| 58 | return date;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public void setDate(Date date) {
|
---|
| 62 | this.date = date;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public int getFreeSpace() {
|
---|
| 66 | return freeSpace;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | public void setFreeSpace(int freeSpace) {
|
---|
| 70 | this.freeSpace = freeSpace;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public Date getTime() {
|
---|
| 74 | return time;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | public void setTime(Date time) {
|
---|
| 78 | this.time = time;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | public Collection<String> getRoutes() {
|
---|
| 82 | return routes;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | public void setRoutes(Collection<String> routes) {
|
---|
| 86 | this.routes = routes;
|
---|
| 87 | }
|
---|
[07f4e8b] | 88 |
|
---|
| 89 | public Double getMaxPrice() {
|
---|
| 90 | return maxPrice;
|
---|
| 91 | }
|
---|
[e6c2521] | 92 | }
|
---|