Skip to content

Commit

Permalink
Merge pull request #419 from kdhrubo/feature/417_oracle9i_release
Browse files Browse the repository at this point in the history
Feature/417 oracle9i release
  • Loading branch information
kdhrubo authored Apr 2, 2024
2 parents 1453252 + a554382 commit 8bdeb94
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom-oracle9i.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.github</groupId>
<artifactId>db2rest-oracle9i</artifactId>
<version>0.2.5-SNAPSHOT</version>
<version>0.2.5-RC1</version>
<name>db2rest-oracle9i</name>
<description>DB2Rest support for older Oracle9i database.</description>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.github</groupId>
<artifactId>db2rest</artifactId>
<version>0.2.5-SNAPSHOT</version>
<version>0.2.5-RC1</version>
<name>db2rest</name>
<description>db2rest</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.validation.annotation.Validated;

import java.util.List;
import java.util.Objects;

@Getter
@Setter
Expand All @@ -23,9 +24,24 @@ public class Db2RestConfigProperties {
private boolean allowSafeDelete;
private int defaultFetchLimit;

private List<String> includeSchemas;

private MultiTenancy multiTenancy;


public boolean isAllSchema() {

if(Objects.isNull(includeSchemas)) {
return true;
}
else{
return
includeSchemas.stream()
.anyMatch(i -> !StringUtils.equals(i,""));
}
}


public void checkDeleteAllowed(String filter) {
if (StringUtils.isBlank(filter) && allowSafeDelete)
throw new DeleteOpNotAllowedException(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.support.DatabaseMetaDataCallback;


Expand All @@ -23,9 +22,6 @@ public class JdbcMetaDataProvider implements DatabaseMetaDataCallback<DbMeta> {

private final Db2RestConfigProperties db2RestConfigProperties;

@Value("${INCLUDE_SCHEMAS}")
private String includedSchemas;

//TODO include schemas , tables , view, filters filters
@Override
public DbMeta processMetaData(DatabaseMetaData databaseMetaData) throws SQLException {
Expand All @@ -44,21 +40,21 @@ public DbMeta processMetaData(DatabaseMetaData databaseMetaData) throws SQLExcep
log.info("Driver Name - {}", driverName);
log.info("Driver Version - {}", driverVersion);

log.info("IncludedSchemas - {}", includedSchemas);

log.info("IncludedSchemas - {}", db2RestConfigProperties.getIncludeSchemas());

List<DbTable> dbTables = new ArrayList<>();

if(StringUtils.isBlank(includedSchemas)) {
if(db2RestConfigProperties.isAllSchema()) {
log.info("Fetching all schema meta data.");
List<DbTable> tables = getDbTables(databaseMetaData, null, productName, majorVersion);

dbTables.addAll(tables);
}
else{
String [] schemas = StringUtils.split(includedSchemas, ",");
log.info("Fetching meta data for selected schemas.");

for(String schema : schemas) {
for(String schema : db2RestConfigProperties.getIncludeSchemas()) {

log.info("Loading meta data for schema - {}", schema);

Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ db2rest:
defaultFetchLimit: ${DEFAULT_FETCH_LIMIT:100}
datasource:
type: ${DATASOURCE_TYPE:jdbc}
includeSchemas: ${INCLUDE_SCHEMAS}
includeTables: ${INCLUDE_TABLES:#{null}}

includeTables: ${INCLUDE_TABLES:}
includeCatalogs: ${INCLUDE_CATALOGS:#{null}}
includeSchemas: ${INCLUDE_SCHEMAS:''}

auth:
type: ${AUTH_TYPE:none}
Expand Down

0 comments on commit 8bdeb94

Please sign in to comment.