|
Kereta Yarsi Indonesia
|
Public Member Functions | |
| 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 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) |
Public Attributes | |
| boolean | response = false |
| Session | session = Session.getInstance() |
Static Public Attributes | |
| static Statement | st |
| static ResultSet | rs |
| static PreparedStatement | ps |
Protected Member Functions | |
| Controller (DatabaseConnector databaseConnector) | |
Static Protected Attributes | |
| static DatabaseConnector | databaseConnector |
| static Connection | con |
| static String | sql |
Controller class handles various operations related to the database and application logic. It includes methods for database connection, encryption, and user session management. This class follows a singleton design pattern to ensure only one instance exists.
This class uses the singleton pattern to ensure that only one instance of the controller exists.
Example usage:
Controller controller = Controller.getInstance();
int userCount = controller.getRowCount("user");
|
inlineprotected |
Constructor for Controller. It initializes the DatabaseConnector.
| databaseConnector | the DatabaseConnector instance to use |
|
inlinestatic |
Builds a DefaultTableModel from a ResultSet.
| rs | the ResultSet to process |
| SQLException | if a database access error occurs |
|
inline |
Checks if a specified database exists.
| database | the database to check |
| SQLException | if a database access error occurs |
|
inline |
Counts the number of trains matching the specified criteria.
| stasiunAwal | the starting station |
| stasiunAkhir | the ending station |
| tanggal | the date of departure |
|
inlinestatic |
Encrypts a password using PBKDF2 with HMAC SHA-256.
| password | the password to encrypt |
| salt | the salt to use in the encryption |
|
inline |
Displays an error message dialog.
| title | the title of the dialog |
| message | the message to display |
| HeadlessException | if an error occurs |
|
inline |
Executes a specified SQL query without parameters.
| sql | the SQL query to execute |
|
inline |
Executes a specified SQL query with parameters.
| sql | the SQL query to execute |
| values | the parameters to set in the query |
|
inline |
Executes a specified SQL update (INSERT, UPDATE, DELETE) with parameters.
| sql | the SQL update to execute |
| values | the parameters to set in the update |
|
inline |
Finds all records from a specified table.
| table | the table to query |
|
inline |
Finds specific trains matching the criteria.
| stasiunAwal | the starting station |
| stasiunAkhir | the ending station |
| tanggal | the date of departure |
|
inline |
Finds records from a table where a specific column matches a keyword.
| table | the table to query |
| columnName | the column to search |
| keyword | the keyword to match |
|
inline |
Generates a random key of a specified length.
| keyLength | the length of the key in bytes |
|
inlinestatic |
Generates a random salt for password hashing.
| saltIteration | the length of the salt in bytes |
|
inline |
Retrieves the column count of a specified table.
| table | the table to query |
|
inline |
Retrieves the column names of a specified table.
| table | the table to query |
|
inlinestatic |
Returns the singleton instance of the Controller.
Reimplemented in controller.AdminController, controller.PassengerController, controller.StationController, controller.TicketController, controller.TrainController, and controller.UserController.
|
inlinestatic |
Retrieves the current PreparedStatement.
|
inline |
Retrieves the row count of a specified table.
| table | the table to query |
|
inline |
Retrieves the row count of a specified table where a column matches a keyword.
| table | the table to query |
| columnName | the column to search |
| keyword | the keyword to match |
|
inlinestatic |
Retrieves the current ResultSet.
|
inlinestatic |
Returns the singleton instance of the Session.
|
inlinestatic |
Retrieves the current Statement.
|
inline |
Hashes a password using PBKDF2 with HMAC SHA-1.
| str | the password to hash |
|
inline |
Checks if a string contains any special characters.
| str | the string to check |
|
inline |
Checks if a string contains any uppercase characters.
| str | the string to check |
|
inline |
Checks if a string contains any whitespace characters.
| str | the string to check |
|
inline |
Displays an informational message dialog.
| message | the message to display |
| HeadlessException | if an error occurs |
|
inline |
Inserts a new record into a specified table.
| table | the table to insert into |
| withID | whether to include an ID column |
| value | the values to insert |
|
inline |
Sets the initial train information for a session.
| stasiunAsal | the starting station |
| stasiunAkhir | the ending station |
| tanggalPergi | the departure date |
| tanggalPulang | the return date |
|
inlinestatic |
Sets the current PreparedStatement.
| aPs | the PreparedStatement to set |
|
inlinestatic |
Sets the current ResultSet.
| aRs | the ResultSet to set |
|
inlinestatic |
Sets the current Statement.
| aSt | the Statement to set |
|
inlinestatic |
Verifies if the input password matches the stored password.
| inputPassword | the password to verify |
| storedPassword | the stored hashed password |
| salt | the salt used in hashing |
|
inline |
Displays a warning message dialog.
| message | the message to display |
| HeadlessException | if an error occurs |
|
staticprotected |
|
staticprotected |
|
static |
| boolean controller.Controller.response = false |
|
static |
| Session controller.Controller.session = Session.getInstance() |
|
staticprotected |
|
static |