How priya-priyadharshini/airline-reservation-system-fixed works
Purpose and Runtime
This is a server-rendered airline reservation system: users register, search flights, select seats, add passengers, pay, and view tickets/bookings; administrators manage flights, users, and bookings. It is a Java Maven application with Spring-style application, controller, service, repository, and template layers. Entry point: airline-reservation-system/src/main/java/com/airline/AirlineReservationSystemApplication.java; build/runtime definition: airline-reservation-system/pom.xml.
HTTP UI and Entry Boundaries
MVC controllers accept browser requests, place model data for server rendering, and divide routes by role and workflow:
• Authentication: src/main/java/com/airline/controller/AuthController.java
• User booking workflow: src/main/java/com/airline/controller/UserController.java
• Administrative operations: src/main/java/com/airline/controller/AdminController.java
Views are Thymeleaf-style templates under src/main/resources/templates/, notably user search/seat/payment pages and admin dashboards. Static styling is served from src/main/resources/static/css/style.css.
Authentication and Authorization
AuthController handles login and registration through request DTOs. AuthInterceptor is the central request boundary for authenticated/authorized access, while AppConfig likely registers interceptor and MVC behavior:
• src/main/java/com/airline/config/AuthInterceptor.java
• src/main/java/com/airline/config/AppConfig.java
• src/main/java/com/airline/entity/User.java
• src/main/java/com/airline/entity/Role.java
The application distinguishes normal users from administrators and routes them into separate controller/template areas.
Flight Inventory and Search
Flight availability is modeled through flights and seats, including status fields. User search presents candidate flights, while administrators create/update flight inventory:
• src/main/java/com/airline/service/FlightService.java
• src/main/java/com/airline/entity/Flight.java
• src/main/java/com/airline/entity/Seat.java
• src/main/java/com/airline/repository/FlightRepository.java
The key control boundary is service-layer enforcement between controllers and persistence; repositories encapsulate database access.
Booking Lifecycle
BookingService is the primary transactional domain coordinator. The expected lifecycle is flight selection → seat selection → passenger capture → booking/payment → ticket display/history. Its persisted aggregate spans booking, passenger, payment, ticket, and seat state:
• src/main/java/com/airline/service/BookingService.java
• src/main/java/com/airline/entity/Booking.java
• src/main/java/com/airline/entity/Passenger.java
• src/main/java/com/airline/entity/Ticket.java
Status enums (BookingStatus, PaymentStatus, FlightStatus) define lifecycle state boundaries.
Persistence and Initialization
The data layer uses entity-specific repositories, backed by a local H2-style database artifact at data/airline_db.mv.db. Database structure is also represented in schema.sql; startup/sample-data initialization is centralized in DataLoader:
• src/main/java/com/airline/config/DataLoader.java
• airline-reservation-system/schema.sql
• airline-reservation-system/data/airline_db.mv.db
• src/main/resources/application.properties
There are no visible integrations with payment gateways, airline APIs, message brokers, or external identity providers; payment is modeled internally.
DTO and Presentation Flow
Request-specific DTOs isolate browser form payloads from JPA/domain entities, especially for login, registration, passenger creation, and payment:
• src/main/java/com/airline/dto/LoginDto.java
• src/main/java/com/airline/dto/PassengerDto.java
• src/main/java/com/airline/dto/PaymentDto.java
Templates map directly to major workflow states: templates/user/search.html, templates/user/seats.html, templates/user/payment.html, and templates/user/ticket.html. Booking/ticket codes are likely generated through src/main/java/com/airline/util/CodeGenerator.java.
Main entry points: AirlineReservationSystemApplication.java Application · airline_db.mv.db H2 database · pom.xml Maven build
Components 19
Runtime
- Application
airline-reservation-system/src/main/java/com/airline/AirlineReservationSystemApplication.java - Maven build
airline-reservation-system/pom.xml
MVC UI
- MVC configuration
- Auth interceptor · Enforces authenticated and role-based routes.
- Authentication
- User booking flow
- Administration
- Form DTOs · Login, passenger, and payment form payloads.
Domain Services
- Flight service · Searches availability and manages flight inventory.
- Booking service · Coordinates seats, passengers, booking, payment, and tickets.
- Code generator · Generates booking and ticket codes.
Persistence
- Users and roles
- Flights and seats · Availability and flight status state.
- Booking aggregate · Booking, passenger, payment, ticket, and lifecycle status.
- Repositories · Entity-specific persistence boundary.
- H2 database
airline-reservation-system/data/airline_db.mv.db - Data loader
Server Views
- Booking templates · Search, seats, payment, ticket, and admin pages.
- Site styling
Connections 25
- Maven build → Application: builds and runs
- Application → MVC configuration: initializes
- MVC configuration → Auth interceptor: registers
- Auth interceptor → Authentication: guards requests
- Auth interceptor → User booking flow: guards requests
- Auth interceptor → Administration: guards requests
- Authentication → Form DTOs: binds forms
- Authentication → Users and roles: authenticates users
- User booking flow → Form DTOs: binds forms
- User booking flow → Flight service: searches flights
- User booking flow → Booking service: creates and pays bookings
- Administration → Flight service: manages inventory
- Administration → Booking service: manages bookings
- Flight service → Repositories: persists inventory
- Booking service → Repositories: persists lifecycle
- Booking service → Code generator: generates codes
- Repositories → Users and roles: maps
- Repositories → Flights and seats: maps
- Repositories → Booking aggregate: maps
- Repositories → H2 database: reads and writes
- Data loader → H2 database: seeds at startup
- Authentication → Booking templates: renders
- User booking flow → Booking templates: renders workflow
- Administration → Booking templates: renders dashboards
- Booking templates → Site styling: uses