diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/processes/RunProcessAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/processes/RunProcessAction.java index d2b82ee2..8624b926 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/processes/RunProcessAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/processes/RunProcessAction.java @@ -82,7 +82,7 @@ public class RunProcessAction public static final String BASEPULL_THIS_RUNTIME_KEY = "basepullThisRuntimeKey"; public static final String BASEPULL_LAST_RUNTIME_KEY = "basepullLastRuntimeKey"; public static final String BASEPULL_TIMESTAMP_FIELD = "basepullTimestampField"; - public static final String BASEPULL_CONFIGURATION = "basepullConfiguration"; + public static final String BASEPULL_CONFIGURATION = "basepullConfiguration"; //////////////////////////////////////////////////////////////////////////////////////////////// // indicator that the timestamp field should be updated - e.g., the execute step is finished. // @@ -335,6 +335,13 @@ public class RunProcessAction /////////////////////////////////////////////////// runProcessInput.seedFromProcessState(optionalProcessState.get()); + /////////////////////////////////////////////////////////////////////////////////////////////////// + // if we're restoring an old state, we can discard a previously stored updatedFrontendStepList - // + // it is only needed on the transitional edge from a backend-step to a frontend step, but not // + // in the other directly // + /////////////////////////////////////////////////////////////////////////////////////////////////// + optionalProcessState.get().setUpdatedFrontendStepList(null); + /////////////////////////////////////////////////////////////////////////// // if there were values from the caller, put those (back) in the request // /////////////////////////////////////////////////////////////////////////// @@ -357,7 +364,7 @@ public class RunProcessAction /******************************************************************************* ** Run a single backend step. *******************************************************************************/ - private RunBackendStepOutput runBackendStep(RunProcessInput runProcessInput, QProcessMetaData process, RunProcessOutput runProcessOutput, UUIDAndTypeStateKey stateKey, QBackendStepMetaData backendStep, QProcessMetaData qProcessMetaData, ProcessState processState) throws Exception + protected RunBackendStepOutput runBackendStep(RunProcessInput runProcessInput, QProcessMetaData process, RunProcessOutput runProcessOutput, UUIDAndTypeStateKey stateKey, QBackendStepMetaData backendStep, QProcessMetaData qProcessMetaData, ProcessState processState) throws Exception { RunBackendStepInput runBackendStepInput = new RunBackendStepInput(processState); runBackendStepInput.setProcessName(process.getName()); diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/ProcessState.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/ProcessState.java index ccc95108..c418bd07 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/ProcessState.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/ProcessState.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.metadata.processes.QFrontendStepMetaData; /******************************************************************************* @@ -41,6 +42,11 @@ public class ProcessState implements Serializable private List stepList = new ArrayList<>(); private Optional nextStepName = Optional.empty(); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // maybe, remove this altogether - just let the frontend compute & send if needed... but how does it know last version...? // + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + private List updatedFrontendStepList = null; + /******************************************************************************* @@ -139,4 +145,36 @@ public class ProcessState implements Serializable { this.stepList = stepList; } + + + + /******************************************************************************* + ** Getter for updatedFrontendStepList + *******************************************************************************/ + public List getUpdatedFrontendStepList() + { + return (this.updatedFrontendStepList); + } + + + + /******************************************************************************* + ** Setter for updatedFrontendStepList + *******************************************************************************/ + public void setUpdatedFrontendStepList(List updatedFrontendStepList) + { + this.updatedFrontendStepList = updatedFrontendStepList; + } + + + + /******************************************************************************* + ** Fluent setter for updatedFrontendStepList + *******************************************************************************/ + public ProcessState withUpdatedFrontendStepList(List updatedFrontendStepList) + { + this.updatedFrontendStepList = updatedFrontendStepList; + return (this); + } + } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunBackendStepOutput.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunBackendStepOutput.java index 4cb6aa3b..4754fcaa 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunBackendStepOutput.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunBackendStepOutput.java @@ -49,8 +49,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial private ProcessState processState; private Exception exception; // todo - make optional - private String overrideLastStepName; - private List updatedFrontendStepList = null; + private String overrideLastStepName; // todo - does this need to go into state too?? private List auditInputList = new ArrayList<>(); @@ -416,7 +415,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial *******************************************************************************/ public List getUpdatedFrontendStepList() { - return (this.updatedFrontendStepList); + return (this.processState.getUpdatedFrontendStepList()); } @@ -426,18 +425,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial *******************************************************************************/ public void setUpdatedFrontendStepList(List updatedFrontendStepList) { - this.updatedFrontendStepList = updatedFrontendStepList; - } - - - - /******************************************************************************* - ** Fluent setter for updatedFrontendStepList - *******************************************************************************/ - public RunBackendStepOutput withUpdatedFrontendStepList(List updatedFrontendStepList) - { - this.updatedFrontendStepList = updatedFrontendStepList; - return (this); + this.processState.setUpdatedFrontendStepList(updatedFrontendStepList); } } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunProcessOutput.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunProcessOutput.java index 7e05a660..30a5642a 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunProcessOutput.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/model/actions/processes/RunProcessOutput.java @@ -46,8 +46,6 @@ public class RunProcessOutput extends AbstractActionOutput implements Serializab private String processUUID; private Optional exception = Optional.empty(); - private List updatedFrontendStepList = null; - /******************************************************************************* @@ -334,32 +332,21 @@ public class RunProcessOutput extends AbstractActionOutput implements Serializab /******************************************************************************* - ** Getter for updatedFrontendStepList - *******************************************************************************/ - public List getUpdatedFrontendStepList() - { - return (this.updatedFrontendStepList); - } - - - - /******************************************************************************* - ** Setter for updatedFrontendStepList + ** *******************************************************************************/ public void setUpdatedFrontendStepList(List updatedFrontendStepList) { - this.updatedFrontendStepList = updatedFrontendStepList; + this.processState.setUpdatedFrontendStepList(updatedFrontendStepList); } /******************************************************************************* - ** Fluent setter for updatedFrontendStepList + ** *******************************************************************************/ - public RunProcessOutput withUpdatedFrontendStepList(List updatedFrontendStepList) + public List getUpdatedFrontendStepList() { - this.updatedFrontendStepList = updatedFrontendStepList; - return (this); + return this.processState.getUpdatedFrontendStepList(); } } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLPreviewStep.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLPreviewStep.java index 46383ca8..ab9cd0a9 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLPreviewStep.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLPreviewStep.java @@ -144,6 +144,12 @@ public class StreamedETLPreviewStep extends BaseStreamedETLStep implements Backe BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput); BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput); transformStep.postRun(postRunInput, postRunOutput); + + // todo figure out what kind of test we can get on this + if(postRunOutput.getUpdatedFrontendStepList() != null) + { + runBackendStepOutput.setUpdatedFrontendStepList(postRunOutput.getUpdatedFrontendStepList()); + } } diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLValidateStep.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLValidateStep.java index 1b30c4e1..dd300d03 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLValidateStep.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/StreamedETLValidateStep.java @@ -141,6 +141,11 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput); BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput); transformStep.postRun(postRunInput, postRunOutput); + + if(postRunOutput.getUpdatedFrontendStepList() != null) + { + runBackendStepOutput.setUpdatedFrontendStepList(postRunOutput.getUpdatedFrontendStepList()); + } }