|
@ -1,5 +1,6 @@ |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.HashSet; |
|
|
import java.util.HashSet; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Pattern; |
|
|
import java.util.regex.Pattern; |
|
@ -9,6 +10,8 @@ public class Person { |
|
|
private Address address; |
|
|
private Address address; |
|
|
private String email; |
|
|
private String email; |
|
|
private String phone; |
|
|
private String phone; |
|
|
|
|
|
private FlightRepository flightRepository; |
|
|
|
|
|
private ItineraryRepository itineraryRepository; |
|
|
|
|
|
|
|
|
public Person(String name, Address address, String email, String phone) { |
|
|
public Person(String name, Address address, String email, String phone) { |
|
|
this.name = name; |
|
|
this.name = name; |
|
@ -67,4 +70,16 @@ public class Person { |
|
|
throw new RuntimeException("Phone Number should start with 0"); |
|
|
throw new RuntimeException("Phone Number should start with 0"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String searchFlights(String flightNumber){ |
|
|
|
|
|
String flightDetails = flightRepository.findFlightByFlightNumber(flightNumber); |
|
|
|
|
|
if(flightDetails.isBlank()){ |
|
|
|
|
|
throw new RuntimeException("Flight does not exist."); |
|
|
|
|
|
} |
|
|
|
|
|
return flightDetails; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ArrayList<Itinerary> getItineraries() { |
|
|
|
|
|
return itineraryRepository.findAll(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |