simplify getProcessSummary by using StandardProcessSummaryLineProducer; don't add records to okTo{insert,update} summaries if populateRecordToStore returns null

This commit is contained in:
2023-09-27 19:46:27 -05:00
parent 582d375597
commit a30d8cb490

View File

@ -107,15 +107,7 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
@Override @Override
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen) public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
{ {
ArrayList<ProcessSummaryLineInterface> processSummaryLineList = StandardProcessSummaryLineProducer.toArrayList(okToInsert, okToUpdate, errorMissingKeyField); ArrayList<ProcessSummaryLineInterface> processSummaryLineList = StandardProcessSummaryLineProducer.toArrayList(okToInsert, okToUpdate, errorMissingKeyField, willNotInsert, willNotUpdate);
if(willNotInsert.getCount() > 0)
{
processSummaryLineList.add(willNotInsert);
}
if(willNotUpdate.getCount() > 0)
{
processSummaryLineList.add(willNotUpdate);
}
return (processSummaryLineList); return (processSummaryLineList);
} }
@ -280,12 +272,10 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
if(existingRecord != null && config.performUpdates) if(existingRecord != null && config.performUpdates)
{ {
recordToStore = existingRecord; recordToStore = existingRecord;
okToUpdate.incrementCount();
} }
else if(existingRecord == null && config.performInserts) else if(existingRecord == null && config.performInserts)
{ {
recordToStore = new QRecord(); recordToStore = new QRecord();
okToInsert.incrementCount();
} }
else else
{ {
@ -302,12 +292,21 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
continue; continue;
} }
//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// if we received a record to store add to the output records // // if we received a record to store add to the output records and summary lines //
//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
recordToStore = populateRecordToStore(runBackendStepInput, recordToStore, sourceRecord); recordToStore = populateRecordToStore(runBackendStepInput, recordToStore, sourceRecord);
if(recordToStore != null) if(recordToStore != null)
{ {
if(existingRecord != null)
{
okToUpdate.incrementCount();
}
else
{
okToInsert.incrementCount();
}
runBackendStepOutput.addRecord(recordToStore); runBackendStepOutput.addRecord(recordToStore);
} }
} }