Kereta Yarsi Indonesia
Loading...
Searching...
No Matches
controller.AdminController Class Reference
Inheritance diagram for controller.AdminController:
controller.Controller

Public Member Functions

void display (JTable table)
 
String getSelectedUserRole (int userId)
 
boolean setSelectedUserRole (int userId, String role)
 
boolean invertSelectedUserRole (int userId)
 
boolean deleteUser (int userId)
 
JTable getLastTable ()
 
- Public Member Functions inherited from controller.Controller
void setFirstStuff (String stasiunAsal, String stasiunAkhir, Date tanggalPergi, Date tanggalPulang)
 
int countFoundTrain (String stasiunAwal, String stasiunAkhir, Date tanggal)
 
ResultSet findSpecificTrain (String stasiunAwal, String stasiunAkhir, Date tanggal)
 
ResultSet findAll (String table)
 
ResultSet findWhere (String table, String columnName, Object keyword)
 
ResultSet executeQuery (String sql)
 
ResultSet executeQuery (String sql, Object... values)
 
boolean executeUpdate (String sql, Object... values)
 
boolean insert (String table, boolean withID, Object... value)
 
void errorMessage (String title, String message) throws HeadlessException
 
void warningMessage (String message) throws HeadlessException
 
void infoMessage (String message) throws HeadlessException
 
String[] getColumnName (String table)
 
int getColumnCount (String table)
 
int getRowCount (String table)
 
boolean checkForDatabase (String database) throws SQLException
 
int getRowCountWhere (String table, String columnName, String keyword)
 
boolean hasWhitespace (String str)
 
boolean hasSpecialChar (String str)
 
boolean hasUpperCase (String str)
 
byte[] generateKey (int keyLength)
 
String hashPassword (String str)
 

Static Public Member Functions

static synchronized AdminController getInstance ()
 
- Static Public Member Functions inherited from controller.Controller
static synchronized Controller getInstance ()
 
static synchronized Session getSession ()
 
static byte[] generateSalt (int saltIteration)
 
static String encryptPBKDF2 (String password, byte[] salt)
 
static boolean verifyPassword (String inputPassword, String storedPassword, byte[] salt)
 
static DefaultTableModel buildTableModel (ResultSet rs) throws SQLException
 
static Statement getSt ()
 
static void setSt (Statement aSt)
 
static ResultSet getRs ()
 
static void setRs (ResultSet aRs)
 
static PreparedStatement getPs ()
 
static void setPs (PreparedStatement aPs)
 

Additional Inherited Members

- Public Attributes inherited from controller.Controller
boolean response = false
 
Session session = Session.getInstance()
 
- Static Public Attributes inherited from controller.Controller
static Statement st
 
static ResultSet rs
 
static PreparedStatement ps
 
- Protected Member Functions inherited from controller.Controller
 Controller (DatabaseConnector databaseConnector)
 
- Static Protected Attributes inherited from controller.Controller
static DatabaseConnector databaseConnector
 
static Connection con
 
static String sql
 

Detailed Description

The AdminController class is responsible for managing admin-related operations such as displaying users, managing user roles, and deleting users. This class follows the singleton pattern to ensure only one instance is created.

Author
Muhammad Rizal Anditama Nugraha

Member Function Documentation

◆ deleteUser()

boolean controller.AdminController.deleteUser ( int  userId)
inline

Deletes the user with the specified user ID.

Parameters
userIdThe ID of the user to be deleted.
Returns
True if the user was successfully deleted, false otherwise.

◆ display()

void controller.AdminController.display ( JTable  table)
inline

Displays the user information in the given JTable.

Parameters
tableThe JTable to display the user information in.

◆ getInstance()

static synchronized AdminController controller.AdminController.getInstance ( )
inlinestatic

Returns the singleton instance of AdminController.

Returns
The singleton instance of AdminController.

Reimplemented from controller.Controller.

◆ getLastTable()

JTable controller.AdminController.getLastTable ( )
inline

Returns the last JTable used for displaying user information.

Returns
The last JTable used for displaying user information.

◆ getSelectedUserRole()

String controller.AdminController.getSelectedUserRole ( int  userId)
inline

Retrieves the role of the user with the specified user ID.

Parameters
userIdThe ID of the user whose role is to be retrieved.
Returns
The role of the user, or null if the user is not found.

◆ invertSelectedUserRole()

boolean controller.AdminController.invertSelectedUserRole ( int  userId)
inline

Inverts the role of the user with the specified user ID. If the current role is "admin", it will be changed to "member" and vice versa.

Parameters
userIdThe ID of the user whose role is to be inverted.
Returns
True if the role was successfully inverted, false otherwise.

◆ setSelectedUserRole()

boolean controller.AdminController.setSelectedUserRole ( int  userId,
String  role 
)
inline

Sets the role of the user with the specified user ID.

Parameters
userIdThe ID of the user whose role is to be set.
roleThe new role to be assigned to the user.
Returns
True if the role was successfully updated, false otherwise.

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