Singleton class to manage session information. This class holds the state of the current session including user, ticket, passenger, station, and train details. It also handles user authentication and access checks.
Example usage:
Session session = Session.getInstance();
String currentUsername = session.getUser.getUsername();
- See also
- model.User
-
model.Ticket
-
model.Passenger
-
model.Station
-
model.Train
-
view.MainMenu_KYI
-
view.SignIn_KYI
- Version
- 1.0
- Author
- Muhammad Rizal Anditama Nugraha
◆ Session()
controller.Session.Session |
( |
boolean |
auth, |
|
|
User |
currentUser, |
|
|
Ticket |
currentTicket, |
|
|
List< Passenger > |
currentPassenger, |
|
|
Station |
currentStation, |
|
|
Train |
currentTrain |
|
) |
| |
|
inline |
Parameterized constructor for full initialization.
- Parameters
-
auth | the authentication status |
currentUser | the current user |
currentTicket | the current ticket |
currentPassenger | the current list of passengers |
currentStation | the current station |
currentTrain | the current train |
◆ checkUserAccess()
boolean controller.Session.checkUserAccess |
( |
JFrame |
jFrame | ) |
|
|
inline |
Checks if the user has admin access. If not an admin, displays a message and redirects to the MainMenu_KYI view.
- Parameters
-
- Returns
- true if the user has admin access, false otherwise
◆ checkUserAuth()
boolean controller.Session.checkUserAuth |
( |
JFrame |
jFrame | ) |
|
|
inline |
Checks if the user is authenticated. If not authenticated, displays a message and redirects to the SignIn_KYI view.
- Parameters
-
- Returns
- true if the user is authenticated, false otherwise
◆ clearSession()
void controller.Session.clearSession |
( |
| ) |
|
|
inline |
Clears the current session by setting user, ticket, passenger, station, and train to null.
◆ getInstance()
static synchronized Session controller.Session.getInstance |
( |
| ) |
|
|
inlinestatic |
Returns the single instance of Session. If no instance exists, it creates one using the default constructor.
- Returns
- the singleton instance of Session
◆ getMetodePembayaran()
String controller.Session.getMetodePembayaran |
( |
| ) |
|
|
inline |
Gets the payment method.
- Returns
- the payment method
◆ getPassenger()
List< Passenger > controller.Session.getPassenger |
( |
| ) |
|
|
inline |
Gets the list of current passengers.
- Returns
- the list of current passengers
◆ getPenumpangAnak()
int controller.Session.getPenumpangAnak |
( |
| ) |
|
|
inline |
Gets the number of child passengers.
- Returns
- the number of child passengers
◆ getPenumpangDewasa()
int controller.Session.getPenumpangDewasa |
( |
| ) |
|
|
inline |
Gets the number of adult passengers.
- Returns
- the number of adult passengers
◆ getPenumpangTotal()
int controller.Session.getPenumpangTotal |
( |
| ) |
|
|
inline |
Gets the total number of passengers.
- Returns
- the total number of passengers
◆ getPotonganAsuransi()
double controller.Session.getPotonganAsuransi |
( |
| ) |
|
|
inline |
Gets the insurance discount amount.
- Returns
- the insurance discount amount
◆ getPotonganBiayaPenanganan()
double controller.Session.getPotonganBiayaPenanganan |
( |
| ) |
|
|
inline |
Gets the handling fee discount amount.
- Returns
- the handling fee discount amount
◆ getStation()
Station controller.Session.getStation |
( |
| ) |
|
|
inline |
Gets the current station.
- Returns
- the current station
◆ getSubtotalHarga()
double controller.Session.getSubtotalHarga |
( |
| ) |
|
|
inline |
Gets the subtotal price.
- Returns
- the subtotal price
◆ getTicket()
Ticket controller.Session.getTicket |
( |
| ) |
|
|
inline |
Gets the current ticket.
- Returns
- the current ticket
◆ getTotalHarga()
double controller.Session.getTotalHarga |
( |
| ) |
|
|
inline |
Gets the total price.
- Returns
- the total price
◆ getTrain()
Train controller.Session.getTrain |
( |
| ) |
|
|
inline |
Gets the current train.
- Returns
- the current train
◆ getUser()
User controller.Session.getUser |
( |
| ) |
|
|
inline |
Gets the current user.
- Returns
- the current user
◆ isAuth()
boolean controller.Session.isAuth |
( |
| ) |
|
|
inline |
Checks if the user is authenticated.
- Returns
- true if the user is authenticated, false otherwise
◆ setAuth()
void controller.Session.setAuth |
( |
boolean |
auth | ) |
|
|
inline |
Sets the authentication status of the user.
- Parameters
-
auth | the authentication status to set |
◆ setMetodePembayaran()
void controller.Session.setMetodePembayaran |
( |
String |
metodePembayaran | ) |
|
|
inline |
Sets the payment method.
- Parameters
-
metodePembayaran | the payment method to set |
◆ setPassenger()
void controller.Session.setPassenger |
( |
List< Passenger > |
passenger | ) |
|
|
inline |
Sets the list of current passengers.
- Parameters
-
passenger | the list of passengers to set |
◆ setPenumpangAnak()
void controller.Session.setPenumpangAnak |
( |
int |
penumpangAnak | ) |
|
|
inline |
Sets the number of child passengers.
- Parameters
-
penumpangAnak | the number of child passengers to set |
◆ setPenumpangDewasa()
void controller.Session.setPenumpangDewasa |
( |
int |
penumpangDewasa | ) |
|
|
inline |
Sets the number of adult passengers.
- Parameters
-
penumpangDewasa | the number of adult passengers to set |
◆ setPenumpangTotal()
void controller.Session.setPenumpangTotal |
( |
int |
penumpangTotal | ) |
|
|
inline |
Sets the total number of passengers.
- Parameters
-
penumpangTotal | the total number of passengers to set |
◆ setPotonganAsuransi()
void controller.Session.setPotonganAsuransi |
( |
double |
potonganAsuransi | ) |
|
|
inline |
Sets the insurance discount amount.
- Parameters
-
potonganAsuransi | the insurance discount amount to set |
◆ setPotonganBiayaPenanganan()
void controller.Session.setPotonganBiayaPenanganan |
( |
double |
potonganBiayaPenanganan | ) |
|
|
inline |
Sets the handling fee discount amount.
- Parameters
-
potonganBiayaPenanganan | the handling fee discount amount to set |
◆ setStation()
void controller.Session.setStation |
( |
Station |
station | ) |
|
|
inline |
Sets the current station.
- Parameters
-
station | the station to set |
◆ setSubtotalHarga()
void controller.Session.setSubtotalHarga |
( |
double |
subtotalHarga | ) |
|
|
inline |
Sets the subtotal price.
- Parameters
-
subtotalHarga | the subtotal price to set |
◆ setTicket()
void controller.Session.setTicket |
( |
Ticket |
ticket | ) |
|
|
inline |
Sets the current ticket.
- Parameters
-
◆ setTotalHarga()
void controller.Session.setTotalHarga |
( |
double |
totalHarga | ) |
|
|
inline |
Sets the total price.
- Parameters
-
totalHarga | the total price to set |
◆ setTrain()
void controller.Session.setTrain |
( |
Train |
train | ) |
|
|
inline |
Sets the current train.
- Parameters
-
◆ setUser()
void controller.Session.setUser |
( |
User |
user | ) |
|
|
inline |
Sets the current user.
- Parameters
-
The documentation for this class was generated from the following file: