[57e58a3] | 1 | package com.example.skychasemk.model;
|
---|
| 2 |
|
---|
| 3 | import jakarta.persistence.*;
|
---|
| 4 |
|
---|
| 5 | import java.util.List;
|
---|
| 6 |
|
---|
| 7 | @Entity
|
---|
[3d60932] | 8 | @Table(name="destination")
|
---|
[57e58a3] | 9 | public class Destination {
|
---|
| 10 |
|
---|
| 11 | @Id
|
---|
| 12 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[3d60932] | 13 | @Column(name = "destinationid")
|
---|
[57e58a3] | 14 |
|
---|
| 15 | private Integer destinationID;
|
---|
[3d60932] | 16 | @Column(name = "name")
|
---|
[57e58a3] | 17 |
|
---|
| 18 | private String name;
|
---|
[3d60932] | 19 | @Column(name = "country")
|
---|
[57e58a3] | 20 |
|
---|
| 21 | private String country;
|
---|
[3d60932] | 22 | @Column(name = "description")
|
---|
[57e58a3] | 23 |
|
---|
| 24 | private String description;
|
---|
| 25 | @Column(name = "popular_attraction")
|
---|
| 26 |
|
---|
| 27 | private String popularAttraction;
|
---|
| 28 | @Column(name = "best_time_to_visit")
|
---|
| 29 |
|
---|
| 30 | private String bestTimeToVisit;
|
---|
| 31 |
|
---|
| 32 | public Integer getDestinationID() {
|
---|
| 33 | return destinationID;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public void setDestinationID(Integer destinationID) {
|
---|
| 37 | this.destinationID = destinationID;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public String getName() {
|
---|
| 41 | return name;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | public void setName(String name) {
|
---|
| 45 | this.name = name;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public String getCountry() {
|
---|
| 49 | return country;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | public void setCountry(String country) {
|
---|
| 53 | this.country = country;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public String getDescription() {
|
---|
| 57 | return description;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public void setDescription(String description) {
|
---|
| 61 | this.description = description;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public String getPopularAttraction() {
|
---|
| 65 | return popularAttraction;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public void setPopularAttraction(String popularAttraction) {
|
---|
| 69 | this.popularAttraction = popularAttraction;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public String getBestTimeToVisit() {
|
---|
| 73 | return bestTimeToVisit;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | public void setBestTimeToVisit(String bestTimeToVisit) {
|
---|
| 77 | this.bestTimeToVisit = bestTimeToVisit;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | public static Integer getAirportID(String cityName, List<Destination> destinations) {
|
---|
| 81 | for (Destination destination : destinations) {
|
---|
| 82 | if (destination.getName().equalsIgnoreCase(cityName)) {
|
---|
| 83 | return destination.getDestinationID();
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 | return null;
|
---|
| 87 | }
|
---|
| 88 | }
|
---|