Kereta Yarsi Indonesia
Loading...
Searching...
No Matches
controller.Session Class Reference

Public Member Functions

 Session (boolean auth, User currentUser, Ticket currentTicket, List< Passenger > currentPassenger, Station currentStation, Train currentTrain)
 
void clearSession ()
 
boolean checkUserAuth (JFrame jFrame)
 
boolean checkUserAccess (JFrame jFrame)
 
User getUser ()
 
void setUser (User user)
 
Ticket getTicket ()
 
void setTicket (Ticket ticket)
 
List< PassengergetPassenger ()
 
void setPassenger (List< Passenger > passenger)
 
Station getStation ()
 
void setStation (Station station)
 
Train getTrain ()
 
void setTrain (Train train)
 
boolean isAuth ()
 
void setAuth (boolean auth)
 
int getPenumpangDewasa ()
 
void setPenumpangDewasa (int penumpangDewasa)
 
int getPenumpangAnak ()
 
void setPenumpangAnak (int penumpangAnak)
 
int getPenumpangTotal ()
 
void setPenumpangTotal (int penumpangTotal)
 
String getMetodePembayaran ()
 
void setMetodePembayaran (String metodePembayaran)
 
double getSubtotalHarga ()
 
void setSubtotalHarga (double subtotalHarga)
 
double getTotalHarga ()
 
void setTotalHarga (double totalHarga)
 
double getPotonganAsuransi ()
 
void setPotonganAsuransi (double potonganAsuransi)
 
double getPotonganBiayaPenanganan ()
 
void setPotonganBiayaPenanganan (double potonganBiayaPenanganan)
 

Static Public Member Functions

static synchronized Session getInstance ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Session()

controller.Session.Session ( boolean  auth,
User  currentUser,
Ticket  currentTicket,
List< Passenger currentPassenger,
Station  currentStation,
Train  currentTrain 
)
inline

Parameterized constructor for full initialization.

Parameters
auththe authentication status
currentUserthe current user
currentTicketthe current ticket
currentPassengerthe current list of passengers
currentStationthe current station
currentTrainthe current train

Member Function Documentation

◆ 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
jFramethe current JFrame
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
jFramethe current JFrame
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
auththe authentication status to set

◆ setMetodePembayaran()

void controller.Session.setMetodePembayaran ( String  metodePembayaran)
inline

Sets the payment method.

Parameters
metodePembayaranthe payment method to set

◆ setPassenger()

void controller.Session.setPassenger ( List< Passenger passenger)
inline

Sets the list of current passengers.

Parameters
passengerthe list of passengers to set

◆ setPenumpangAnak()

void controller.Session.setPenumpangAnak ( int  penumpangAnak)
inline

Sets the number of child passengers.

Parameters
penumpangAnakthe number of child passengers to set

◆ setPenumpangDewasa()

void controller.Session.setPenumpangDewasa ( int  penumpangDewasa)
inline

Sets the number of adult passengers.

Parameters
penumpangDewasathe number of adult passengers to set

◆ setPenumpangTotal()

void controller.Session.setPenumpangTotal ( int  penumpangTotal)
inline

Sets the total number of passengers.

Parameters
penumpangTotalthe total number of passengers to set

◆ setPotonganAsuransi()

void controller.Session.setPotonganAsuransi ( double  potonganAsuransi)
inline

Sets the insurance discount amount.

Parameters
potonganAsuransithe insurance discount amount to set

◆ setPotonganBiayaPenanganan()

void controller.Session.setPotonganBiayaPenanganan ( double  potonganBiayaPenanganan)
inline

Sets the handling fee discount amount.

Parameters
potonganBiayaPenangananthe handling fee discount amount to set

◆ setStation()

void controller.Session.setStation ( Station  station)
inline

Sets the current station.

Parameters
stationthe station to set

◆ setSubtotalHarga()

void controller.Session.setSubtotalHarga ( double  subtotalHarga)
inline

Sets the subtotal price.

Parameters
subtotalHargathe subtotal price to set

◆ setTicket()

void controller.Session.setTicket ( Ticket  ticket)
inline

Sets the current ticket.

Parameters
ticketthe ticket to set

◆ setTotalHarga()

void controller.Session.setTotalHarga ( double  totalHarga)
inline

Sets the total price.

Parameters
totalHargathe total price to set

◆ setTrain()

void controller.Session.setTrain ( Train  train)
inline

Sets the current train.

Parameters
trainthe train to set

◆ setUser()

void controller.Session.setUser ( User  user)
inline

Sets the current user.

Parameters
userthe user to set

The documentation for this class was generated from the following file: