mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
QQQ-28 small cleanups
This commit is contained in:
@ -26,6 +26,7 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
@ -107,6 +108,7 @@ public class RunBackendStepAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<QFieldMetaData> fieldsToGet = new ArrayList<>();
|
List<QFieldMetaData> fieldsToGet = new ArrayList<>();
|
||||||
|
List<QFieldMetaData> requiredFieldsMissing = new ArrayList<>();
|
||||||
for(QFieldMetaData field : inputMetaData.getFieldList())
|
for(QFieldMetaData field : inputMetaData.getFieldList())
|
||||||
{
|
{
|
||||||
Serializable value = runBackendStepInput.getValue(field.getName());
|
Serializable value = runBackendStepInput.getValue(field.getName());
|
||||||
@ -118,8 +120,11 @@ public class RunBackendStepAction
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// todo - check if required?
|
|
||||||
fieldsToGet.add(field);
|
fieldsToGet.add(field);
|
||||||
|
if(field.getIsRequired())
|
||||||
|
{
|
||||||
|
requiredFieldsMissing.add(field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +134,18 @@ public class RunBackendStepAction
|
|||||||
QProcessCallback callback = runBackendStepInput.getCallback();
|
QProcessCallback callback = runBackendStepInput.getCallback();
|
||||||
if(callback == null)
|
if(callback == null)
|
||||||
{
|
{
|
||||||
|
if(requiredFieldsMissing.isEmpty())
|
||||||
|
{
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// if no required fields are missing, just return gracefully //
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
// but if any required fields ARE missing, then that's an error. //
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
LOG.info("Missing value for required fields: " + requiredFieldsMissing.stream().map(QFieldMetaData::getName).collect(Collectors.joining(", ")));
|
||||||
throw (new QUserFacingException("Missing values for one or more fields",
|
throw (new QUserFacingException("Missing values for one or more fields",
|
||||||
new QException("Function is missing values for fields, but no callback was present to request fields from a user")));
|
new QException("Function is missing values for fields, but no callback was present to request fields from a user")));
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ public class LoadInitialRecordsStep implements BackendStep
|
|||||||
// but, while we're here, go ahead and put the query filter in the payload as a value, in case //
|
// but, while we're here, go ahead and put the query filter in the payload as a value, in case //
|
||||||
// someone else wants it (see BulkDelete) //
|
// someone else wants it (see BulkDelete) //
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
runBackendStepInput.getAsyncJobCallback().updateStatus("Loading records");
|
||||||
QQueryFilter queryFilter = runBackendStepInput.getCallback().getQueryFilter();
|
QQueryFilter queryFilter = runBackendStepInput.getCallback().getQueryFilter();
|
||||||
runBackendStepOutput.addValue("queryFilterJSON", JsonUtils.toJson(queryFilter));
|
runBackendStepOutput.addValue("queryFilterJSON", JsonUtils.toJson(queryFilter));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user