Interface DatasourceHelperService
public interface DatasourceHelperService
-
Method Summary
Modifier and TypeMethodDescriptioncopyTable(DatabaseDatasource sourceDatasource, String sourceTable, DatabaseDatasource destinationDatasource, String destinationTable, List<String> primaryKeys, boolean copyPrimaryKeys, int batchSize) fetchDatasourceMetadata(String driverClass, String jdbcUrl, String jdbcUsername, String jdbcPassword, Map<String, List<String>> methodDescriptions) fetchDatasourceMetadata(DatabaseDatasource datasource, Map<String, List<String>> methodDescriptions) Dynamically calls a methods from the class DatabaseMetaData.fetchInfoDatasourceMetadata(String driverClass, String jdbcUrl, String jdbcUsername, String jdbcPassword, boolean datasourceInfo, boolean jdbcUrlInfo, boolean databaseFunctionsInfo, boolean databaseSupportsInfo) fetchInfoDatasourceMetadata(DatasourceDefinition datasource, boolean datasourceInfo, boolean jdbcUrlInfo, boolean databaseFunctionsInfo, boolean databaseSupportsInfo) Fetches general metadata information about a given datasource.getColumnMetadata(DatabaseDatasource datasource, String table) getColumnMetadata(DatabaseDatasource datasource, String table, List<String> additionalColumns) Provides a map containing what information is fetched when using fetchDatasourceMetadata().getGeneralInformation(DatasourceDefinition datasource) getNonExistingColumns(DatabaseDatasource datasource, String table, List<String> columns) Returns the columns which do not exist in the given table.getQuery(DatasourceContainer datasourceContainer) booleantableExists(DatabaseDatasource datasource, String table)
-
Method Details
-
copyTable
Map<String,Object> copyTable(DatabaseDatasource sourceDatasource, String sourceTable, DatabaseDatasource destinationDatasource, String destinationTable, List<String> primaryKeys, boolean copyPrimaryKeys, int batchSize) -
tableExists
-
getNonExistingColumns
List<String> getNonExistingColumns(DatabaseDatasource datasource, String table, List<String> columns) Returns the columns which do not exist in the given table. This is a subset of the columns parameter. If the result is empty, all columns are found in the given table.- Parameters:
datasource- the datasourcetable- the table to checkcolumns- the columns to check- Returns:
- the non-existing columns in the table
-
getColumnMetadata
-
getColumnMetadata
-
fetchDatasourceMetadata
Map<String,Object> fetchDatasourceMetadata(DatabaseDatasource datasource, Map<String, List<String>> methodDescriptions) throws SQLExceptionDynamically calls a methods from the class DatabaseMetaData. Any method is call-able. The call fails if argument count and name does not match exactly one method of said class. The call fails as well if the args cannot be converted into the needed parameter types. If "null" is passed as a String in args it will be evaluated to null as an Object. Boolean and Integer are converted using String.toBoolean() and String.toInteger()- Parameters:
datasource- the datasourcemethodDescriptions- is a map with the structure keys:= method name as String | values:= parameters as List of String- Returns:
- a map with the structure keys:= method name as String | values:= return-object of called method
- Throws:
SQLException
-
fetchDatasourceMetadata
Map<String,Object> fetchDatasourceMetadata(String driverClass, String jdbcUrl, String jdbcUsername, String jdbcPassword, Map<String, List<String>> methodDescriptions) throws SQLException- Throws:
SQLException
-
fetchInfoDatasourceMetadata
Map<String,Object> fetchInfoDatasourceMetadata(DatasourceDefinition datasource, boolean datasourceInfo, boolean jdbcUrlInfo, boolean databaseFunctionsInfo, boolean databaseSupportsInfo) throws SQLException Fetches general metadata information about a given datasource. Information about which data is acquired withgetDatasourceInfoDefinition(), which provides a config map- Parameters:
datasource- the datasourcedatasourceInfo- if true, fetches general informationjdbcUrlInfo- if true, fetches URL informationdatabaseFunctionsInfo- if true, fetches information on functionsdatabaseSupportsInfo- if true, fetches information on supports- Returns:
- the map containing invalid input: '<'methodname, result>
- Throws:
SQLException
-
fetchInfoDatasourceMetadata
Map<String,Object> fetchInfoDatasourceMetadata(String driverClass, String jdbcUrl, String jdbcUsername, String jdbcPassword, boolean datasourceInfo, boolean jdbcUrlInfo, boolean databaseFunctionsInfo, boolean databaseSupportsInfo) throws SQLException - Throws:
SQLException
-
getDatasourceInfoDefinition
Map<DatasourceInfoType,Map<String, getDatasourceInfoDefinition()String>> Provides a map containing what information is fetched when using fetchDatasourceMetadata(). This map has keys of typeDatasourceInfoType. Each key points to another Map of type invalid input: '<'String,String> with the structure 'method description' -> 'method name'- Returns:
- the config map
-
getQuery
-
getGeneralInformation
-