CE-938 move updatedFrontendStepList into state

This commit is contained in:
2024-05-29 10:17:43 -05:00
parent eb8bf12047
commit 11e1fb86b2
6 changed files with 66 additions and 35 deletions

View File

@ -82,7 +82,7 @@ public class RunProcessAction
public static final String BASEPULL_THIS_RUNTIME_KEY = "basepullThisRuntimeKey"; public static final String BASEPULL_THIS_RUNTIME_KEY = "basepullThisRuntimeKey";
public static final String BASEPULL_LAST_RUNTIME_KEY = "basepullLastRuntimeKey"; public static final String BASEPULL_LAST_RUNTIME_KEY = "basepullLastRuntimeKey";
public static final String BASEPULL_TIMESTAMP_FIELD = "basepullTimestampField"; 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. // // 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()); 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 // // 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. ** 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 runBackendStepInput = new RunBackendStepInput(processState);
runBackendStepInput.setProcessName(process.getName()); runBackendStepInput.setProcessName(process.getName());

View File

@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import com.kingsrook.qqq.backend.core.model.data.QRecord; 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<String> stepList = new ArrayList<>(); private List<String> stepList = new ArrayList<>();
private Optional<String> nextStepName = Optional.empty(); private Optional<String> nextStepName = Optional.empty();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// maybe, remove this altogether - just let the frontend compute & send if needed... but how does it know last version...? //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private List<QFrontendStepMetaData> updatedFrontendStepList = null;
/******************************************************************************* /*******************************************************************************
@ -139,4 +145,36 @@ public class ProcessState implements Serializable
{ {
this.stepList = stepList; this.stepList = stepList;
} }
/*******************************************************************************
** Getter for updatedFrontendStepList
*******************************************************************************/
public List<QFrontendStepMetaData> getUpdatedFrontendStepList()
{
return (this.updatedFrontendStepList);
}
/*******************************************************************************
** Setter for updatedFrontendStepList
*******************************************************************************/
public void setUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList)
{
this.updatedFrontendStepList = updatedFrontendStepList;
}
/*******************************************************************************
** Fluent setter for updatedFrontendStepList
*******************************************************************************/
public ProcessState withUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList)
{
this.updatedFrontendStepList = updatedFrontendStepList;
return (this);
}
} }

View File

@ -49,8 +49,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial
private ProcessState processState; private ProcessState processState;
private Exception exception; // todo - make optional private Exception exception; // todo - make optional
private String overrideLastStepName; private String overrideLastStepName; // todo - does this need to go into state too??
private List<QFrontendStepMetaData> updatedFrontendStepList = null;
private List<AuditInput> auditInputList = new ArrayList<>(); private List<AuditInput> auditInputList = new ArrayList<>();
@ -416,7 +415,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial
*******************************************************************************/ *******************************************************************************/
public List<QFrontendStepMetaData> getUpdatedFrontendStepList() public List<QFrontendStepMetaData> getUpdatedFrontendStepList()
{ {
return (this.updatedFrontendStepList); return (this.processState.getUpdatedFrontendStepList());
} }
@ -426,18 +425,7 @@ public class RunBackendStepOutput extends AbstractActionOutput implements Serial
*******************************************************************************/ *******************************************************************************/
public void setUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList) public void setUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList)
{ {
this.updatedFrontendStepList = updatedFrontendStepList; this.processState.setUpdatedFrontendStepList(updatedFrontendStepList);
}
/*******************************************************************************
** Fluent setter for updatedFrontendStepList
*******************************************************************************/
public RunBackendStepOutput withUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList)
{
this.updatedFrontendStepList = updatedFrontendStepList;
return (this);
} }
} }

View File

@ -46,8 +46,6 @@ public class RunProcessOutput extends AbstractActionOutput implements Serializab
private String processUUID; private String processUUID;
private Optional<Exception> exception = Optional.empty(); private Optional<Exception> exception = Optional.empty();
private List<QFrontendStepMetaData> updatedFrontendStepList = null;
/******************************************************************************* /*******************************************************************************
@ -334,32 +332,21 @@ public class RunProcessOutput extends AbstractActionOutput implements Serializab
/******************************************************************************* /*******************************************************************************
** Getter for updatedFrontendStepList **
*******************************************************************************/
public List<QFrontendStepMetaData> getUpdatedFrontendStepList()
{
return (this.updatedFrontendStepList);
}
/*******************************************************************************
** Setter for updatedFrontendStepList
*******************************************************************************/ *******************************************************************************/
public void setUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList) public void setUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList)
{ {
this.updatedFrontendStepList = updatedFrontendStepList; this.processState.setUpdatedFrontendStepList(updatedFrontendStepList);
} }
/******************************************************************************* /*******************************************************************************
** Fluent setter for updatedFrontendStepList **
*******************************************************************************/ *******************************************************************************/
public RunProcessOutput withUpdatedFrontendStepList(List<QFrontendStepMetaData> updatedFrontendStepList) public List<QFrontendStepMetaData> getUpdatedFrontendStepList()
{ {
this.updatedFrontendStepList = updatedFrontendStepList; return this.processState.getUpdatedFrontendStepList();
return (this);
} }
} }

View File

@ -144,6 +144,12 @@ public class StreamedETLPreviewStep extends BaseStreamedETLStep implements Backe
BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput); BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput);
BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput); BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput);
transformStep.postRun(postRunInput, postRunOutput); transformStep.postRun(postRunInput, postRunOutput);
// todo figure out what kind of test we can get on this
if(postRunOutput.getUpdatedFrontendStepList() != null)
{
runBackendStepOutput.setUpdatedFrontendStepList(postRunOutput.getUpdatedFrontendStepList());
}
} }

View File

@ -141,6 +141,11 @@ public class StreamedETLValidateStep extends BaseStreamedETLStep implements Back
BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput); BackendStepPostRunOutput postRunOutput = new BackendStepPostRunOutput(runBackendStepOutput);
BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput); BackendStepPostRunInput postRunInput = new BackendStepPostRunInput(runBackendStepInput);
transformStep.postRun(postRunInput, postRunOutput); transformStep.postRun(postRunInput, postRunOutput);
if(postRunOutput.getUpdatedFrontendStepList() != null)
{
runBackendStepOutput.setUpdatedFrontendStepList(postRunOutput.getUpdatedFrontendStepList());
}
} }