mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-19 21:50:45 +00:00
Make postRun methods take a subclass of backendInput/Output, that make it clear they don't have the full record list
This commit is contained in:
@ -65,6 +65,8 @@ import com.kingsrook.qqq.backend.core.model.metadata.reporting.QReportView;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.reporting.ReportType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.AbstractTransformStep;
|
||||
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunInput;
|
||||
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunOutput;
|
||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||
import com.kingsrook.qqq.backend.core.utils.Pair;
|
||||
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||
@ -355,7 +357,7 @@ public class GenerateReportAction
|
||||
////////////////////////////////////////////////
|
||||
if(transformStep != null)
|
||||
{
|
||||
transformStep.postRun(transformStepInput, transformStepOutput);
|
||||
transformStep.postRun(new BackendStepPostRunInput(transformStepInput), new BackendStepPostRunOutput(transformStepOutput));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public abstract class AbstractLoadStep implements BackendStep
|
||||
** Allow subclasses to do an action after the run is complete - after the last
|
||||
** page of records is passed in.
|
||||
*******************************************************************************/
|
||||
public void postRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
public void postRun(BackendStepPostRunInput runBackendStepInput, BackendStepPostRunOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
////////////////////////
|
||||
// noop in base class //
|
||||
|
@ -63,7 +63,7 @@ public abstract class AbstractTransformStep implements BackendStep, ProcessSumma
|
||||
** Allow subclasses to do an action after the run is complete - after the last
|
||||
** page of records is passed in.
|
||||
*******************************************************************************/
|
||||
public void postRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
public void postRun(BackendStepPostRunInput runBackendStepInput, BackendStepPostRunOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
////////////////////////
|
||||
// noop in base class //
|
||||
|
@ -138,8 +138,20 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
|
||||
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_PROCESS_SUMMARY, transformStep.doGetProcessSummary(runBackendStepOutput, true));
|
||||
}
|
||||
|
||||
transformStep.postRun(runBackendStepInput, runBackendStepOutput);
|
||||
loadStep.postRun(runBackendStepInput, runBackendStepOutput);
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// use a subclass of runBackendStepOutput that makes it clear you can't use the recordList, as it's a "preview/subset" record list //
|
||||
// this prevents bugs where you might think you have the full record list, but really don't //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput);
|
||||
BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput);
|
||||
transformStep.postRun(postRunInput, postRunOutput);
|
||||
loadStep.postRun(postRunInput, postRunOutput);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// explicitly copy values back into the runStepOutput from the post-run output //
|
||||
// this might not be needed, since they (presumably) share a processState object, but just in case that changes... //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
runBackendStepOutput.setValues(postRunOutput.getValues());
|
||||
|
||||
if(recordCount > 0)
|
||||
{
|
||||
|
@ -124,7 +124,9 @@ public class StreamedETLPreviewStep extends BaseStreamedETLStep implements Backe
|
||||
updateRecordsWithDisplayValuesAndPossibleValues(runBackendStepInput, previewRecordList);
|
||||
runBackendStepOutput.setRecords(previewRecordList);
|
||||
|
||||
transformStep.postRun(runBackendStepInput, runBackendStepOutput);
|
||||
BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput);
|
||||
BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput);
|
||||
transformStep.postRun(postRunInput, postRunOutput);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +108,9 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back
|
||||
//////////////////////////////////////////////////////
|
||||
runBackendStepOutput.addValue(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY, transformStep.doGetProcessSummary(runBackendStepOutput, false));
|
||||
|
||||
transformStep.postRun(runBackendStepInput, runBackendStepOutput);
|
||||
BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput);
|
||||
BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput);
|
||||
transformStep.postRun(postRunInput, postRunOutput);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user