diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/reporting/RecordPipe.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/reporting/RecordPipe.java index c41e7f08..2ed70d09 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/reporting/RecordPipe.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/reporting/RecordPipe.java @@ -45,17 +45,28 @@ public class RecordPipe private Consumer> postRecordActions = null; + ///////////////////////////////////// + // See usage below for explanation // + ///////////////////////////////////// + private List singleRecordListForPostRecordActions = new ArrayList<>(); /******************************************************************************* - ** Add a record to the pipe - ** Returns true iff the record fit in the pipe; false if the pipe is currently full. + ** Add a record to the pipe. Will block if the pipe is full. *******************************************************************************/ public void addRecord(QRecord record) { if(postRecordActions != null) { - postRecordActions.accept(List.of(record)); + //////////////////////////////////////////////////////////////////////////////////// + // the initial use-case of this method is to call QueryAction.postRecordActions // + // that method requires that the list param be modifiable. Originally we used // + // List.of here - but that is immutable, so, instead use this single-record-list // + // (which we'll create as a field in this class, to avoid always re-constructing) // + //////////////////////////////////////////////////////////////////////////////////// + singleRecordListForPostRecordActions.add(record); + postRecordActions.accept(singleRecordListForPostRecordActions); + record = singleRecordListForPostRecordActions.remove(0); } doAddRecord(record); diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java index d492dd97..55eb17c9 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java @@ -84,11 +84,16 @@ public class QueryAction /******************************************************************************* - ** + ** Run the necessary actions on a list of records (which must be a mutable list - e.g., + ** not one created via List.of()). This may include setting display values, + ** translating possible values, and running post-record customizations. *******************************************************************************/ public void postRecordActions(List records) { - this.postQueryRecordCustomizer.ifPresent(qRecordQRecordFunction -> records.replaceAll(qRecordQRecordFunction::apply)); + if(this.postQueryRecordCustomizer.isPresent()) + { + records.replaceAll(t -> postQueryRecordCustomizer.get().apply(t)); + } if(queryInput.getShouldGenerateDisplayValues()) {