Kereta Yarsi Indonesia
|
Public Member Functions | |
boolean | createUser (User user) |
User | getUser (int userID) |
User | getUserByUsername (String username) |
boolean | updateUser (User user) |
boolean | deleteUser (int userID) |
boolean | register (User user) |
boolean | login (String username, String password) |
User | loginAndGetUser (String username, String password) |
boolean | register (String username, String password) |
void | manageUsers (User user) |
![]() | |
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) |
boolean | createUser (User user) |
User | getUser (int userID) |
User | getUserByUsername (String username) |
boolean | updateUser (User user) |
boolean | deleteUser (int userID) |
boolean | register (User user) |
boolean | login (String username, String password) |
Static Public Member Functions | |
static synchronized UserController | getInstance () |
![]() | |
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 | |
![]() | |
boolean | response = false |
Session | session = Session.getInstance() |
![]() | |
static Statement | st |
static ResultSet | rs |
static PreparedStatement | ps |
![]() | |
Controller (DatabaseConnector databaseConnector) | |
![]() | |
static DatabaseConnector | databaseConnector |
static Connection | con |
static String | sql |
Controller class for managing operations related to users. Implements the UserDAO interface to provide methods for user management.
This class uses the singleton pattern to ensure that only one instance of the controller exists.
Example usage:
UserController controller = UserController.getInstance(); boolean isLogin = controller.login("myworld", "theworld213");
|
inline |
Creates a new user in the database.
user | the User object representing the user to create |
Implements model.UserDAO.
|
inline |
Deletes a user from the database by user ID.
userID | the ID of the user to delete |
Implements model.UserDAO.
|
inlinestatic |
Returns the single instance of UserController. If no instance exists, it creates one using the provided DatabaseConnector.
Reimplemented from controller.Controller.
|
inline |
Retrieves a user from the database by user ID.
userID | the ID of the user to retrieve |
Implements model.UserDAO.
|
inline |
Retrieves a user from the database by username.
username | the username of the user to retrieve |
Implements model.UserDAO.
|
inline |
Authenticates a user login based on username and password.
username | the username of the user attempting to log in |
password | the password of the user attempting to log in |
Implements model.UserDAO.
|
inline |
Performs user login and retrieves the User object if successful.
username | the username of the user attempting to log in |
password | the password of the user attempting to log in |
|
inline |
Manages users based on the role of the provided User object.
user | the User object whose role determines the actions allowed |
|
inline |
Registers a new user in the database with the provided username and password. Automatically generates a salt for password encryption.
username | the username of the user to register |
password | the password of the user to register |
|
inline |
Registers a new user in the database.
user | the User object representing the user to register |
Implements model.UserDAO.
|
inline |
Updates an existing user in the database.
user | the User object representing the updated user information |
Implements model.UserDAO.