Skip to content

Commit

Permalink
update add to map logic
Browse files Browse the repository at this point in the history
  • Loading branch information
AnaghHegde committed Jul 1, 2024
1 parent 3a0653f commit 239a42f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,9 @@ private Mono<Datasource> createEx(
.create(datasourceStorage, isDryOps)
.map(datasourceStorage1 -> {
if (datasourceStorageDryRunQueries != null && isDryOps) {
if (datasourceStorageDryRunQueries.containsKey(DBOpsType.SAVE.name())) {
datasourceStorageDryRunQueries
.get(DBOpsType.SAVE.name())
.add(datasourceStorage1);
} else {
List<DatasourceStorage> datasourceStorageList = new ArrayList<>();
datasourceStorageList.add(datasourceStorage1);
datasourceStorageDryRunQueries.put(
DBOpsType.SAVE.name(), datasourceStorageList);
}
datasourceStorageDryRunQueries
.computeIfAbsent(DBOpsType.SAVE.name(), k -> new ArrayList<>())
.add(datasourceStorage1);
}
return datasourceStorage1;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,6 @@ public Flux<Datasource> getEntitiesPresentInWorkspace(String workspaceId) {

private void addDryOpsForEntity(
DBOpsType queryType, Map<String, List<Datasource>> dryRunOpsMap, Datasource createdDatasource) {
if (dryRunOpsMap.containsKey(queryType.name())) {
dryRunOpsMap.get(queryType.name()).add(createdDatasource);
} else {
List<Datasource> datasourceList = new ArrayList<>();
datasourceList.add(createdDatasource);
dryRunOpsMap.put(queryType.name(), datasourceList);
}
dryRunOpsMap.computeIfAbsent(queryType.name(), k -> new ArrayList<>()).add(createdDatasource);
}
}

0 comments on commit 239a42f

Please sign in to comment.