Pass original records in as oldRecords for UpdateAction.performValidations

This commit is contained in:
2023-06-06 19:25:05 -05:00
parent b52a014154
commit 3b398942e7

View File

@ -146,6 +146,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
// Build records-to-update for passing into the validation method of the Update action //
/////////////////////////////////////////////////////////////////////////////////////////
List<QRecord> recordsForValidation = new ArrayList<>();
List<QRecord> originalRecords = new ArrayList<>();
Map<Serializable, QRecord> pkeyToFullRecordMap = new HashMap<>();
for(QRecord record : runBackendStepInput.getRecords())
{
@ -154,6 +155,11 @@ public class BulkEditTransformStep extends AbstractTransformStep
setUpdatedFieldsInRecord(runBackendStepInput, enabledFields, recordToUpdate);
recordsForValidation.add(recordToUpdate);
////////////////////////////////////////////////////////////////////////////////////////
// add to list of original records - for input to validation, for looking for changes //
////////////////////////////////////////////////////////////////////////////////////////
originalRecords.add(new QRecord(record));
/////////////////////////////////////////////////////////////
// put the full record (with updated values) in the output //
/////////////////////////////////////////////////////////////
@ -168,7 +174,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
updateInput.setInputSource(QInputSource.USER);
updateInput.setTableName(table.getName());
updateInput.setRecords(recordsForValidation);
new UpdateAction().performValidations(updateInput, Optional.of(runBackendStepInput.getRecords()), true);
new UpdateAction().performValidations(updateInput, Optional.of(originalRecords), true);
/////////////////////////////////////////////////////////////
// look at the update input to build process summary lines //