Skip to content

Commit

Permalink
Fix bug adding two adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
tuncpolat committed Aug 28, 2023
1 parent 661d9d4 commit f8d198c
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,32 @@ public Table createBlockchainTable( CatalogTable catalogTable, List<CatalogColum
ethereumDataSource,
catalogTable.id
);

log.warn( catalogTable.name );
log.warn( catalogTable.getNamespaceName() );
log.warn( catalogTable.getDatabaseName() );
log.warn( catalogTable.getOwnerName() );
Boolean eventDataRetrieval = false; //ethereumDataSource.getEventDataRetrieval();
boolean eventDataRetrieval = ethereumDataSource.isEventDataRetrieval();
if (eventDataRetrieval) {
String originalName = getOriginalName(catalogTable.name); // remove the last digit for key search in eventDataMap

tableBuilder
.contractAddress(ethereumDataSource.getSmartContractAddressFromCatalogTable(catalogTable.name))
.contractAddress(ethereumDataSource.getSmartContractAddressFromCatalogTable(originalName))
.fromBlock(ethereumDataSource.getFromBlock())
.toBlock(ethereumDataSource.getToBlock())
.event(ethereumDataSource.getEventFromCatalogTable(catalogTable.name));
.event(ethereumDataSource.getEventFromCatalogTable(originalName));
}
EthereumTable table = tableBuilder.build();
tableMap.put( catalogTable.name, table );
return table;
}

public static String getOriginalName(String catalogName) {
if (catalogName == null || catalogName.isEmpty()) {
return catalogName;
}
char lastChar = catalogName.charAt(catalogName.length() - 1);
if (Character.isDigit(lastChar)) {
return catalogName.substring(0, catalogName.length() - 1);
}
return catalogName;
}


@Override
public Map<String, Table> getTableMap() {
Expand Down

0 comments on commit f8d198c

Please sign in to comment.