You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
71 lines
1.9 KiB
package hs.fulda.de.ci.exam.project;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import static hs.fulda.de.ci.exam.project.PaymentStatus.Completed;
|
|
import static hs.fulda.de.ci.exam.project.ReservationStatus.Confirmed;
|
|
|
|
public class FlightReservation {
|
|
String reservationNumber;
|
|
FlightInstance flight;
|
|
HashMap<Passenger, FlightSeat> seatMap;
|
|
ReservationStatus status;
|
|
|
|
public FlightReservation(String reservationNumber, FlightInstance flight, HashMap<Passenger, FlightSeat> seatMap, ReservationStatus status) {
|
|
this.reservationNumber = reservationNumber;
|
|
this.flight = flight;
|
|
this.seatMap = seatMap;
|
|
this.status = status;
|
|
}
|
|
|
|
public FlightReservation(){
|
|
|
|
}
|
|
|
|
|
|
public String getReservationNumber() {
|
|
return reservationNumber;
|
|
}
|
|
|
|
public void setReservationNumber(String reservationNumber) {
|
|
this.reservationNumber = reservationNumber;
|
|
}
|
|
|
|
public FlightInstance getFlight() {
|
|
return flight;
|
|
}
|
|
|
|
public void setFlight(FlightInstance flight) {
|
|
this.flight = flight;
|
|
}
|
|
|
|
public HashMap<Passenger, FlightSeat> getSeatMap() {
|
|
return seatMap;
|
|
}
|
|
|
|
public void setSeatMap(HashMap<Passenger, FlightSeat> seatMap) {
|
|
this.seatMap = seatMap;
|
|
}
|
|
|
|
public ReservationStatus getStatus() {
|
|
return status;
|
|
}
|
|
|
|
public void setStatus(ReservationStatus status) {
|
|
this.status = status;
|
|
}
|
|
|
|
public void makePayment(Payment credit_card_payment) {
|
|
System.out.println("processing payment");
|
|
credit_card_payment.status = Completed;
|
|
status = Confirmed;
|
|
}
|
|
|
|
public boolean notifyUser(String type, String email, String content) {
|
|
Notification notification = null;
|
|
switch (type) {
|
|
case "email": notification = new EmailNotification(email, content);
|
|
}
|
|
return notification.sendNotification();
|
|
}
|
|
}
|