mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
CE-781 - eliminate instance validation errors when using FilesystemImporterStep FIELD_IMPORT_SECURITY_VALUE_SUPPLIERs
This commit is contained in:
@ -31,6 +31,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
@ -1244,7 +1245,25 @@ public class QInstanceValidator
|
||||
{
|
||||
if(fieldMetaData.getDefaultValue() != null && fieldMetaData.getDefaultValue() instanceof QCodeReference codeReference)
|
||||
{
|
||||
validateSimpleCodeReference("Process " + processName + " backend step code reference: ", codeReference, BackendStep.class);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// by default, assume that any process field which is a QCodeReference should be a reference to a BackendStep... //
|
||||
// but... allow a secondary field name to be set, to tell us what class to *actually* expect here... //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Class<?> expectedClass = BackendStep.class;
|
||||
try
|
||||
{
|
||||
Optional<QFieldMetaData> expectedTypeField = backendStepMetaData.getInputMetaData().getField(fieldMetaData.getName() + "_expectedType");
|
||||
if(expectedTypeField.isPresent() && expectedTypeField.get().getDefaultValue() != null)
|
||||
{
|
||||
expectedClass = Class.forName(ValueUtils.getValueAsString(expectedTypeField.get().getDefaultValue()));
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
warn("Error loading expectedType for field [" + fieldMetaData.getName() + "] in process [" + processName + "]: " + e.getMessage());
|
||||
}
|
||||
|
||||
validateSimpleCodeReference("Process " + processName + " code reference: ", codeReference, expectedClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ import com.kingsrook.qqq.backend.core.actions.metadata.JoinGraph;
|
||||
import com.kingsrook.qqq.backend.core.actions.metadata.MetaDataAction;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.instances.QInstanceValidationKey;
|
||||
import com.kingsrook.qqq.backend.core.instances.QMetaDataElementInterface;
|
||||
import com.kingsrook.qqq.backend.core.instances.visitors.QMetaDataVisitorInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataOutput;
|
||||
@ -65,7 +67,7 @@ import io.github.cdimascio.dotenv.DotenvEntry;
|
||||
** Container for all meta-data in a running instance of a QQQ application.
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QInstance
|
||||
public class QInstance implements QMetaDataElementInterface
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Do not let the backend data be serialized - e.g., sent to a frontend user //
|
||||
@ -746,12 +748,22 @@ public class QInstance
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for hasBeenValidated
|
||||
** If pass a QInstanceValidationKey (which can only be instantiated by the validator),
|
||||
** then the hasBeenValidated field will be set to true.
|
||||
**
|
||||
** Else, if passed a null, hasBeenValidated will be reset to false - e.g., to
|
||||
** re-trigger validation (can be useful in tests).
|
||||
*******************************************************************************/
|
||||
public void setHasBeenValidated(QInstanceValidationKey key)
|
||||
{
|
||||
this.hasBeenValidated = true;
|
||||
if(key == null)
|
||||
{
|
||||
this.hasBeenValidated = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hasBeenValidated = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1208,4 +1220,25 @@ public class QInstance
|
||||
metaData.addSelfToInstance(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public List<QMetaDataElementInterface> getChildren()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public void acceptVisitor(QMetaDataVisitorInterface visitor)
|
||||
{
|
||||
visitor.visitQInstance(this);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user