Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions rewrite-core/src/main/java/org/openrewrite/DataTableStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ static DataTableStore noop() {
*/
Stream<?> getRows(String dataTableName, @Nullable String group);

/**
* Stream all rows for a given data table name, merging across all
* groups and instance names.
*
* @param dataTableName the fully qualified class name of the data table
* @return a stream of all rows across all buckets with this name
*/
default Stream<?> getAllRows(String dataTableName) {
return getRows(dataTableName, null);
}

/**
* Get the set of {@link DataTable} instances that have received rows.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ private static Stream<Object> snapshotRows(Bucket bucket) {
return snapshot.stream();
}

@Override
public Stream<?> getAllRows(String dataTableName) {
List<Object> allRows = new ArrayList<>();
for (Bucket bucket : buckets.values()) {
if (bucket.dataTable.getName().equals(dataTableName)) {
synchronized (bucket.rows) {
allRows.addAll(bucket.rows);
}
}
}
return allRows.stream();
}

@Override
public Collection<DataTable<?>> getDataTables() {
List<DataTable<?>> result = new ArrayList<>(buckets.size());
Expand Down