Adding status object in standard loadVia steps and updating it in api insert; add user timezone header to session

This commit is contained in:
2022-11-04 09:46:08 -05:00
parent f99430d2bc
commit 669b6d3cb7
12 changed files with 85 additions and 13 deletions

View File

@ -97,6 +97,30 @@ public class AsyncJobCallback
/*******************************************************************************
** Increase the 'current' value in the '1 of 2' sense.
*******************************************************************************/
public void incrementCurrent()
{
incrementCurrent(1);
}
/*******************************************************************************
** Increase the 'current' value in the '1 of 2' sense.
*******************************************************************************/
public void incrementCurrent(int amount)
{
if(this.asyncJobStatus.getCurrent() != null)
{
this.asyncJobStatus.setCurrent(this.asyncJobStatus.getCurrent() + amount);
storeUpdatedStatus();
}
}
/*******************************************************************************
** Remove the values from the current & total fields
*******************************************************************************/

View File

@ -174,7 +174,7 @@ public class PollingAutomationPerTableRunner implements Runnable
public void run()
{
Thread.currentThread().setName(name);
LOG.info("Running " + this.getClass().getSimpleName() + "[" + name + "]");
LOG.debug("Running " + this.getClass().getSimpleName() + "[" + name + "]");
try
{

View File

@ -58,6 +58,7 @@ public class LoadViaDeleteStep extends AbstractLoadStep
deleteInput.setSession(runBackendStepInput.getSession());
deleteInput.setTableName(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
deleteInput.setPrimaryKeys(runBackendStepInput.getRecords().stream().map(r -> r.getValue(table.getPrimaryKeyField())).collect(Collectors.toList()));
deleteInput.setAsyncJobCallback(runBackendStepInput.getAsyncJobCallback());
// todo? can make more efficient deletes, maybe? deleteInput.setQueryFilter();
getTransaction().ifPresent(deleteInput::setTransaction);
new DeleteAction().execute(deleteInput);

View File

@ -82,6 +82,7 @@ public class LoadViaInsertOrUpdateStep extends AbstractLoadStep
insertInput.setTableName(tableMetaData.getName());
insertInput.setRecords(runBackendStepInput.getRecords());
getTransaction().ifPresent(insertInput::setTransaction);
insertInput.setAsyncJobCallback(runBackendStepInput.getAsyncJobCallback());
InsertOutput insertOutput = new InsertAction().execute(insertInput);
runBackendStepOutput.getRecords().addAll(insertOutput.getRecords());
}
@ -93,6 +94,7 @@ public class LoadViaInsertOrUpdateStep extends AbstractLoadStep
updateInput.setTableName(tableMetaData.getName());
updateInput.setRecords(runBackendStepInput.getRecords());
getTransaction().ifPresent(updateInput::setTransaction);
updateInput.setAsyncJobCallback(runBackendStepInput.getAsyncJobCallback());
UpdateOutput updateOutput = new UpdateAction().execute(updateInput);
runBackendStepOutput.getRecords().addAll(updateOutput.getRecords());
}

View File

@ -54,6 +54,7 @@ public class LoadViaInsertStep extends AbstractLoadStep
insertInput.setTableName(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
insertInput.setRecords(runBackendStepInput.getRecords());
getTransaction().ifPresent(insertInput::setTransaction);
insertInput.setAsyncJobCallback(runBackendStepInput.getAsyncJobCallback());
InsertOutput insertOutput = new InsertAction().execute(insertInput);
runBackendStepOutput.getRecords().addAll(insertOutput.getRecords());
}

View File

@ -56,6 +56,7 @@ public class LoadViaUpdateStep extends AbstractLoadStep
updateInput.setTableName(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
updateInput.setRecords(runBackendStepInput.getRecords());
getTransaction().ifPresent(updateInput::setTransaction);
updateInput.setAsyncJobCallback(runBackendStepInput.getAsyncJobCallback());
UpdateOutput updateOutput = new UpdateAction().execute(updateInput);
runBackendStepOutput.getRecords().addAll(updateOutput.getRecords());
}

View File

@ -89,7 +89,7 @@ public class StandardScheduledExecutor
{
if(!runningState.equals(RunningState.STOPPED))
{
LOG.info("Request to start from an invalid running state [" + runningState + "]. Must be STOPPED.");
LOG.warn("Request to start from an invalid running state [" + runningState + "]. Must be STOPPED.");
return (false);
}
@ -121,7 +121,7 @@ public class StandardScheduledExecutor
{
if(!runningState.equals(RunningState.RUNNING))
{
LOG.info("Request to stop from an invalid running state [" + runningState + "]. Must be RUNNING.");
LOG.warn("Request to stop from an invalid running state [" + runningState + "]. Must be RUNNING.");
return (false);
}
@ -138,7 +138,7 @@ public class StandardScheduledExecutor
return (true);
}
LOG.info("Timed out waiting for service to fully terminate. Will be left in STOPPING state.");
LOG.warn("Timed out waiting for service to fully terminate. Will be left in STOPPING state.");
}
catch(InterruptedException ie)
{