Package com.iizix.server.db
Class DBFunctions
java.lang.Object
com.iizix.server.db.DBFunctions
Database functions are placed in this class.
- Author:
- Christopher Mindus
- Method SummaryModifier and TypeMethodDescription- static <RESULT> RESULT- execute- (DBOperation<RESULT> op) Executes a method using a functional interface using an new pooled database connection, closed before returning from this method.- static <RESULT> RESULT- execute- (Connection conn, DBOperation<RESULT> op) Executes a method using a functional interface using an existing connection.- static longGets the unique App ID from an application name ID string.- static long- getAppID- (Connection conn, String appNameID) Gets the unique App ID from an application name ID string.- static DBApp[]- getEnabledApps- (Set<String> ignoreAppIDs) Gets all enabled apps from the database.- static DBFunctionsGets the DBFunctions instance.
- Method Details- getInstanceGets the DBFunctions instance.- Returns:
- The DBFunctions instance.
- Throws:
- SQLException- For connection, class loader or instantiation failures.
- SecurityException- When access is denied.
 
- executepublic static <RESULT> RESULT execute- (DBOperation<RESULT> op) throws SQLException, NotFoundException Executes a method using a functional interface using an new pooled database connection, closed before returning from this method.- Type Parameters:
- RESULT- The return value.
- Returns:
- The result.
- Throws:
- NotFoundException- When searched element is not found.
- SQLException- For SQL errors in getting the Connection as well as executing the SQL.
 
- executepublic static <RESULT> RESULT execute- (Connection conn, DBOperation<RESULT> op) throws SQLException, NotFoundException Executes a method using a functional interface using an existing connection.- Type Parameters:
- RESULT- The return value.
- Parameters:
- conn- The connection, or- nullto get a new connection and close it before returning.
- Returns:
- The result.
- Throws:
- NotFoundException- When searched element is not found.
- SQLException- For SQL errors in getting the Connection as well as executing the SQL.
 
- getAppIDGets the unique App ID from an application name ID string.- Parameters:
- appNameID- The Application name ID ('app_name_id' column in table IZS.APPS).
- Returns:
- The unique App ID.
- Throws:
- NotFoundException- If the- Application name IDis not found.
- SQLException- If a database errors occurs.
 
- getAppIDpublic static long getAppID- (Connection conn, String appNameID) throws NotFoundException, SQLException Gets the unique App ID from an application name ID string.- Parameters:
- conn- The database connection, null to get a new one.
- appNameID- The Application name ID ('app_name_id' column in table IZS.APPS).
- Returns:
- The unique App ID.
- Throws:
- NotFoundException- If the- Application name IDis not found.
- SQLException- If a database errors occurs.
 
- getEnabledAppsGets all enabled apps from the database. If an app should be loaded from the database and it fails, this method will log this as a severe error and not return that app entry in the array.- Parameters:
- ignoreAppIDs- Application IDs to ignore because they have been loaded from command line parameters of the server, effectively overriding database definition
- Throws:
- SQLException- If a database errors occurs.