mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
Refactor to get rid of Usage parameter in QCodeReference
This commit is contained in:
@ -74,7 +74,7 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
||||
return (new Builder(new QWidgetMetaData()
|
||||
.withName(join.getName())
|
||||
.withIsCard(true)
|
||||
.withCodeReference(new QCodeReference(ChildRecordListRenderer.class, null))
|
||||
.withCodeReference(new QCodeReference(ChildRecordListRenderer.class))
|
||||
.withType(WidgetType.CHILD_RECORD_LIST.getType())
|
||||
.withDefaultValue("joinName", join.getName())));
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment;
|
||||
@ -706,7 +705,7 @@ public class QInstanceEnricher
|
||||
.withTableName(table.getName())
|
||||
.withIsHidden(true)
|
||||
.withPermissionRules(qInstance.getDefaultPermissionRules().clone()
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class, QCodeUsage.CUSTOMIZER)));
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class)));
|
||||
|
||||
List<QFieldMetaData> editableFields = new ArrayList<>();
|
||||
for(QFieldSection section : CollectionUtils.nonNullList(table.getSections()))
|
||||
@ -770,7 +769,7 @@ public class QInstanceEnricher
|
||||
.withTableName(table.getName())
|
||||
.withIsHidden(true)
|
||||
.withPermissionRules(qInstance.getDefaultPermissionRules().clone()
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class, QCodeUsage.CUSTOMIZER)));
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class)));
|
||||
|
||||
List<QFieldMetaData> editableFields = table.getFields().values().stream()
|
||||
.filter(QFieldMetaData::getIsEditable)
|
||||
@ -817,7 +816,7 @@ public class QInstanceEnricher
|
||||
.withTableName(table.getName())
|
||||
.withIsHidden(true)
|
||||
.withPermissionRules(qInstance.getDefaultPermissionRules().clone()
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class, QCodeUsage.CUSTOMIZER)));
|
||||
.withCustomPermissionChecker(new QCodeReference(BulkTableActionProcessPermissionChecker.class)));
|
||||
|
||||
List<QFieldMetaData> tableFields = table.getFields().values().stream().toList();
|
||||
process.getFrontendStep("review").setRecordListFields(tableFields);
|
||||
|
@ -31,7 +31,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
import com.kingsrook.qqq.backend.core.actions.automation.RecordAutomationHandler;
|
||||
@ -51,7 +50,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QMiddlewareInstanceMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinOn;
|
||||
@ -909,9 +907,9 @@ public class QInstanceValidator
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private void validateTableCustomizer(String tableName, String customizerName, QCodeReference codeReference)
|
||||
private void validateTableCustomizer(String tableName, String roleName, QCodeReference codeReference)
|
||||
{
|
||||
String prefix = "Table " + tableName + ", customizer " + customizerName + ": ";
|
||||
String prefix = "Table " + tableName + ", customizer " + roleName + ": ";
|
||||
|
||||
if(!preAssertionsForCodeReference(codeReference, prefix))
|
||||
{
|
||||
@ -934,7 +932,7 @@ public class QInstanceValidator
|
||||
//////////////////////////////////////////////////
|
||||
Object customizerInstance = getInstanceOfCodeReference(prefix, customizerClass);
|
||||
|
||||
TableCustomizers tableCustomizer = TableCustomizers.forRole(customizerName);
|
||||
TableCustomizers tableCustomizer = TableCustomizers.forRole(roleName);
|
||||
if(tableCustomizer == null)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -947,29 +945,9 @@ public class QInstanceValidator
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// make sure the customizer instance can be cast to the expected type //
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if(customizerInstance != null && tableCustomizer.getTableCustomizer().getExpectedType() != null)
|
||||
if(customizerInstance != null && tableCustomizer.getExpectedType() != null)
|
||||
{
|
||||
Object castedObject = getCastedObject(prefix, tableCustomizer.getTableCustomizer().getExpectedType(), customizerInstance);
|
||||
|
||||
Consumer<Object> validationFunction = tableCustomizer.getTableCustomizer().getValidationFunction();
|
||||
if(castedObject != null && validationFunction != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
validationFunction.accept(castedObject);
|
||||
}
|
||||
catch(ClassCastException e)
|
||||
{
|
||||
errors.add(prefix + "Error validating customizer type parameters: " + e.getMessage());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// mmm, calling customizers w/ random data is expected to often throw, so, this check is iffy at best... //
|
||||
// if we run into more trouble here, we might consider disabling the whole "validation function" check. //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
assertObjectCanBeCasted(prefix, tableCustomizer.getExpectedType(), customizerInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -979,18 +957,18 @@ public class QInstanceValidator
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Make sure that a given object can be casted to an expected type.
|
||||
*******************************************************************************/
|
||||
private <T> T getCastedObject(String prefix, Class<T> expectedType, Object customizerInstance)
|
||||
private <T> T assertObjectCanBeCasted(String errorPrefix, Class<T> expectedType, Object object)
|
||||
{
|
||||
T castedObject = null;
|
||||
try
|
||||
{
|
||||
castedObject = expectedType.cast(customizerInstance);
|
||||
castedObject = expectedType.cast(object);
|
||||
}
|
||||
catch(ClassCastException e)
|
||||
{
|
||||
errors.add(prefix + "CodeReference is not of the expected type: " + expectedType);
|
||||
errors.add(errorPrefix + "CodeReference is not of the expected type: " + expectedType);
|
||||
}
|
||||
return castedObject;
|
||||
}
|
||||
@ -1504,7 +1482,6 @@ public class QInstanceValidator
|
||||
|
||||
if(assertCondition(possibleValueSource.getCustomCodeReference() != null, "custom-type possibleValueSource " + pvsName + " is missing a customCodeReference."))
|
||||
{
|
||||
assertCondition(QCodeUsage.POSSIBLE_VALUE_PROVIDER.equals(possibleValueSource.getCustomCodeReference().getCodeUsage()), "customCodeReference for possibleValueSource " + pvsName + " is not a possibleValueProvider.");
|
||||
validateSimpleCodeReference("PossibleValueSource " + pvsName + " custom code reference: ", possibleValueSource.getCustomCodeReference(), QCustomPossibleValueProvider.class);
|
||||
}
|
||||
}
|
||||
@ -1548,7 +1525,7 @@ public class QInstanceValidator
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if(classInstance != null)
|
||||
{
|
||||
getCastedObject(prefix, expectedClass, classInstance);
|
||||
assertObjectCanBeCasted(prefix, expectedClass, classInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,6 @@ package com.kingsrook.qqq.backend.core.model.metadata.code;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.kingsrook.qqq.backend.core.actions.automation.RecordAutomationHandler;
|
||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||
import com.kingsrook.qqq.backend.core.actions.values.QCustomPossibleValueProvider;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -36,7 +33,6 @@ public class QCodeReference implements Serializable
|
||||
{
|
||||
private String name;
|
||||
private QCodeType codeType;
|
||||
private QCodeUsage codeUsage;
|
||||
|
||||
private String inlineCode;
|
||||
|
||||
@ -54,11 +50,10 @@ public class QCodeReference implements Serializable
|
||||
/*******************************************************************************
|
||||
** Constructor that takes all args
|
||||
*******************************************************************************/
|
||||
public QCodeReference(String name, QCodeType codeType, QCodeUsage codeUsage)
|
||||
public QCodeReference(String name, QCodeType codeType)
|
||||
{
|
||||
this.name = name;
|
||||
this.codeType = codeType;
|
||||
this.codeUsage = codeUsage;
|
||||
}
|
||||
|
||||
|
||||
@ -81,35 +76,6 @@ public class QCodeReference implements Serializable
|
||||
{
|
||||
this.name = javaClass.getName();
|
||||
this.codeType = QCodeType.JAVA;
|
||||
|
||||
if(BackendStep.class.isAssignableFrom(javaClass))
|
||||
{
|
||||
this.codeUsage = QCodeUsage.BACKEND_STEP;
|
||||
}
|
||||
else if(QCustomPossibleValueProvider.class.isAssignableFrom(javaClass))
|
||||
{
|
||||
this.codeUsage = QCodeUsage.POSSIBLE_VALUE_PROVIDER;
|
||||
}
|
||||
else if(RecordAutomationHandler.class.isAssignableFrom(javaClass))
|
||||
{
|
||||
this.codeUsage = QCodeUsage.RECORD_AUTOMATION_HANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw (new IllegalStateException("Unable to infer code usage type for class: " + javaClass.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Constructor that just takes a java class and code usage.
|
||||
*******************************************************************************/
|
||||
public QCodeReference(Class<?> javaClass, QCodeUsage codeUsage)
|
||||
{
|
||||
this.name = javaClass.getName();
|
||||
this.codeType = QCodeType.JAVA;
|
||||
this.codeUsage = codeUsage;
|
||||
}
|
||||
|
||||
|
||||
@ -182,40 +148,6 @@ public class QCodeReference implements Serializable
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for codeUsage
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QCodeUsage getCodeUsage()
|
||||
{
|
||||
return codeUsage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for codeUsage
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setCodeUsage(QCodeUsage codeUsage)
|
||||
{
|
||||
this.codeUsage = codeUsage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for codeUsage
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QCodeReference withCodeUsage(QCodeUsage codeUsage)
|
||||
{
|
||||
this.codeUsage = codeUsage;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for inlineCode
|
||||
**
|
||||
|
@ -174,7 +174,7 @@ public class ScriptsMetaDataProvider
|
||||
.withLabel("Contents")
|
||||
.withIsCard(true)
|
||||
.withType(WidgetType.SCRIPT_VIEWER.getType())
|
||||
.withCodeReference(new QCodeReference(DefaultWidgetRenderer.class, null)));
|
||||
.withCodeReference(new QCodeReference(DefaultWidgetRenderer.class)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@ package com.kingsrook.qqq.backend.core.processes.implementations.etl.basic;
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -59,8 +58,7 @@ public class BasicETLProcess
|
||||
.withName(FUNCTION_NAME_EXTRACT)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(BasicETLExtractFunction.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(FIELD_SOURCE_TABLE, QFieldType.STRING)));
|
||||
|
||||
@ -68,8 +66,7 @@ public class BasicETLProcess
|
||||
.withName(FUNCTION_NAME_TRANSFORM)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(BasicETLTransformFunction.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(FIELD_MAPPING_JSON, QFieldType.STRING))
|
||||
.withField(new QFieldMetaData(FIELD_DESTINATION_TABLE, QFieldType.STRING)));
|
||||
@ -78,8 +75,7 @@ public class BasicETLProcess
|
||||
.withName(FUNCTION_NAME_LOAD)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(BasicETLLoadFunction.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(FIELD_DESTINATION_TABLE, QFieldType.STRING)))
|
||||
.withOutputMetaData(new QFunctionOutputMetaData()
|
||||
|
@ -24,7 +24,6 @@ package com.kingsrook.qqq.backend.core.processes.implementations.etl.streamed;
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -59,8 +58,7 @@ public class StreamedETLProcess
|
||||
.withName(FUNCTION_NAME_ETL)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(StreamedETLBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(FIELD_SOURCE_TABLE, QFieldType.STRING))
|
||||
.withField(new QFieldMetaData(FIELD_MAPPING_JSON, QFieldType.STRING))
|
||||
|
@ -29,7 +29,6 @@ import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutp
|
||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionInputMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QRecordListMetaData;
|
||||
@ -71,8 +70,7 @@ public class LoadInitialRecordsStep implements BackendStep
|
||||
.withName("loadInitialRecords")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(LoadInitialRecordsStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData()
|
||||
.withTableName(tableName))));
|
||||
|
@ -33,7 +33,6 @@ import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.modules.backend.implementations.memory.MemoryRecordStore;
|
||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@ -99,7 +98,7 @@ class ChildInserterPostInsertCustomizerTest extends BaseTest
|
||||
private static void addPostInsertActionToTable(QInstance qInstance)
|
||||
{
|
||||
qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY)
|
||||
.withCustomizer(TableCustomizers.POST_INSERT_RECORD.getTableCustomizer(), new QCodeReference(PersonPostInsertAddFavoriteShapeCustomizer.class, QCodeUsage.CUSTOMIZER));
|
||||
.withCustomizer(TableCustomizers.POST_INSERT_RECORD.getRole(), new QCodeReference(PersonPostInsertAddFavoriteShapeCustomizer.class));
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ParentWidgetRendererTest extends BaseTest
|
||||
.withName(ProcessWidgetRenderer.class.getSimpleName())
|
||||
.withGridColumns(12)
|
||||
.withLabel("Test Parent Widget")
|
||||
.withCodeReference(new QCodeReference(ParentWidgetRenderer.class, null))
|
||||
.withCodeReference(new QCodeReference(ParentWidgetRenderer.class))
|
||||
.withIcon("local_shipping");
|
||||
qInstance.addWidget(parentWidget);
|
||||
|
||||
|
@ -78,7 +78,7 @@ class ProcessWidgetRendererTest extends BaseTest
|
||||
.withDefaultValue(ProcessWidgetRenderer.WIDGET_PROCESS_NAME, TestUtils.PROCESS_NAME_GREET_PEOPLE)
|
||||
.withLabel("Test Process Widget")
|
||||
.withGridColumns(6)
|
||||
.withCodeReference(new QCodeReference(ProcessWidgetRenderer.class, null));
|
||||
.withCodeReference(new QCodeReference(ProcessWidgetRenderer.class));
|
||||
qInstance.addWidget(metaData);
|
||||
|
||||
RenderWidgetInput input = new RenderWidgetInput();
|
||||
|
@ -85,7 +85,7 @@ class USMapRendererTest extends BaseTest
|
||||
.withName(USMapWidgetRenderer.class.getSimpleName())
|
||||
.withGridColumns(12)
|
||||
.withLabel("Test Parent Widget")
|
||||
.withCodeReference(new QCodeReference(USMapWidgetRenderer.class, null))
|
||||
.withCodeReference(new QCodeReference(USMapWidgetRenderer.class))
|
||||
.withIcon("local_shipping");
|
||||
qInstance.addWidget(parentWidget);
|
||||
|
||||
|
@ -39,7 +39,6 @@ import com.kingsrook.qqq.backend.core.model.actions.scripts.ExecuteCodeOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.scripts.ScriptsMetaDataProvider;
|
||||
import com.kingsrook.qqq.backend.core.modules.backend.implementations.memory.MemoryRecordStore;
|
||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||
@ -90,7 +89,7 @@ class ExecuteCodeActionTest extends BaseTest
|
||||
private ExecuteCodeInput setupInput(QInstance qInstance, Map<String, Serializable> context, QCodeExecutionLoggerInterface executionLogger)
|
||||
{
|
||||
ExecuteCodeInput executeCodeInput = new ExecuteCodeInput();
|
||||
executeCodeInput.setCodeReference(new QCodeReference(ScriptInJava.class, QCodeUsage.CUSTOMIZER));
|
||||
executeCodeInput.setCodeReference(new QCodeReference(ScriptInJava.class));
|
||||
executeCodeInput.setContext(context);
|
||||
executeCodeInput.setExecutionLogger(executionLogger);
|
||||
return executeCodeInput;
|
||||
|
@ -34,7 +34,6 @@ import com.kingsrook.qqq.backend.core.model.actions.scripts.TestScriptInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.scripts.TestScriptOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
|
||||
@ -60,7 +59,7 @@ class TestScriptActionInterfaceTest extends BaseTest
|
||||
|
||||
TestScriptInput testScriptInput = new TestScriptInput();
|
||||
testScriptInput.setInputValues(Map.of("name", "Darin", "age", 42));
|
||||
testScriptInput.setCodeReference(new QCodeReference(SampleScript.class, QCodeUsage.CUSTOMIZER));
|
||||
testScriptInput.setCodeReference(new QCodeReference(SampleScript.class));
|
||||
TestScriptOutput testScriptOutput = new TestScriptOutput();
|
||||
new SampleTestAction().execute(testScriptInput, testScriptOutput);
|
||||
|
||||
|
@ -46,7 +46,6 @@ import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior;
|
||||
@ -386,25 +385,25 @@ class QInstanceValidatorTest extends BaseTest
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference()),
|
||||
"missing a code reference name", "missing a code type");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(null, QCodeType.JAVA, null)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(null, QCodeType.JAVA)),
|
||||
"missing a code reference name");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("", QCodeType.JAVA, null)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("", QCodeType.JAVA)),
|
||||
"missing a code reference name");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("Test", null, null)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("Test", null)),
|
||||
"missing a code type");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("Test", QCodeType.JAVA, QCodeUsage.CUSTOMIZER)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference("Test", QCodeType.JAVA)),
|
||||
"Class for Test could not be found");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerWithNoVoidConstructor.class, QCodeUsage.CUSTOMIZER)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerWithNoVoidConstructor.class)),
|
||||
"Instance of " + CustomizerWithNoVoidConstructor.class.getSimpleName() + " could not be created");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerThatIsNotOfTheRightBaseClass.class, QCodeUsage.CUSTOMIZER)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerThatIsNotOfTheRightBaseClass.class)),
|
||||
"CodeReference is not of the expected type");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerWithOnlyPrivateConstructor.class, QCodeUsage.CUSTOMIZER)),
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerWithOnlyPrivateConstructor.class)),
|
||||
"it does not have a public parameterless constructor");
|
||||
|
||||
/////////////////////////////////////////////
|
||||
@ -413,7 +412,7 @@ class QInstanceValidatorTest extends BaseTest
|
||||
// assertValidationFailureReasons((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerWithPrivateVisibility.class, QCodeUsage.CUSTOMIZER)),
|
||||
// "it does not have a public parameterless constructor");
|
||||
|
||||
assertValidationSuccess((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerValid.class, QCodeUsage.CUSTOMIZER)));
|
||||
assertValidationSuccess((qInstance) -> qInstance.getTable("person").withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(CustomizerValid.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -912,7 +911,6 @@ class QInstanceValidatorTest extends BaseTest
|
||||
"is missing a customCodeReference");
|
||||
|
||||
assertValidationFailureReasons((qInstance) -> qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_CUSTOM).setCustomCodeReference(new QCodeReference()),
|
||||
"not a possibleValueProvider",
|
||||
"missing a code reference name",
|
||||
"missing a code type");
|
||||
}
|
||||
@ -1437,7 +1435,7 @@ class QInstanceValidatorTest extends BaseTest
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(null, QCodeType.JAVA, null));
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(null, QCodeType.JAVA));
|
||||
},
|
||||
"missing a code reference name");
|
||||
|
||||
@ -1445,7 +1443,7 @@ class QInstanceValidatorTest extends BaseTest
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(ArrayList.class, null));
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(ArrayList.class));
|
||||
},
|
||||
"is not of the expected type");
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ import com.kingsrook.qqq.backend.core.model.actions.tables.update.UpdateOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||
@ -486,7 +485,7 @@ class MemoryBackendModuleTest extends BaseTest
|
||||
///////////////////////////////////
|
||||
// add a customizer to the table //
|
||||
///////////////////////////////////
|
||||
table.withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(ShapeTestCustomizer.class, QCodeUsage.CUSTOMIZER));
|
||||
table.withCustomizer(TableCustomizers.POST_QUERY_RECORD.getRole(), new QCodeReference(ShapeTestCustomizer.class));
|
||||
|
||||
//////////////////
|
||||
// do an insert //
|
||||
|
@ -61,7 +61,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.automation.PollingAutomatio
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.automation.QAutomationProviderMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
@ -239,7 +238,7 @@ public class TestUtils
|
||||
{
|
||||
qInstance.addWidget(new QWidgetMetaData()
|
||||
.withName(PersonsByCreateDateBarChart.class.getSimpleName())
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class, null)));
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -939,8 +938,7 @@ public class TestUtils
|
||||
.withName("prepare")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
@ -977,8 +975,7 @@ public class TestUtils
|
||||
.withName("doWork")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
@ -1018,8 +1015,7 @@ public class TestUtils
|
||||
.withName("getAgeStatistics")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(GetAgeStatistics.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON)))
|
||||
.withOutputMetaData(new QFunctionOutputMetaData()
|
||||
@ -1033,8 +1029,7 @@ public class TestUtils
|
||||
.withName("addAge")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(AddAge.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withFieldList(List.of(new QFieldMetaData("yearsToAdd", QFieldType.INTEGER))))
|
||||
.withOutputMetaData(new QFunctionOutputMetaData()
|
||||
@ -1064,8 +1059,7 @@ public class TestUtils
|
||||
.withName("prepare")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
|
@ -28,7 +28,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.authentication.QAuthenticationMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
@ -94,7 +93,7 @@ public class TestUtils
|
||||
.withAuthorizationType(AuthorizationType.API_KEY_HEADER)
|
||||
.withBaseUrl("http://localhost:9999/mock")
|
||||
.withContentType("application/json")
|
||||
.withActionUtil(new QCodeReference(MockApiActionUtils.class, QCodeUsage.CUSTOMIZER))
|
||||
.withActionUtil(new QCodeReference(MockApiActionUtils.class))
|
||||
);
|
||||
}
|
||||
|
||||
@ -146,7 +145,7 @@ public class TestUtils
|
||||
.withAuthorizationType(AuthorizationType.BASIC_AUTH_API_KEY)
|
||||
.withBaseUrl("https://api.easypost.com/v2/")
|
||||
.withContentType("application/json")
|
||||
.withActionUtil(new QCodeReference(EasyPostUtils.class, QCodeUsage.CUSTOMIZER))
|
||||
.withActionUtil(new QCodeReference(EasyPostUtils.class))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutp
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -127,8 +126,7 @@ public class BasicETLCleanupSourceFilesStep implements BackendStep
|
||||
.withName(STEP_NAME)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(this.getClass().getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.addField(new QFieldMetaData("moveOrDelete", QFieldType.STRING))
|
||||
.addField(new QFieldMetaData("destinationForMoves", QFieldType.STRING))));
|
||||
|
@ -30,7 +30,6 @@ import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInpu
|
||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -76,8 +75,7 @@ public class BasicETLCollectSourceFileNamesStep implements BackendStep
|
||||
.withName(STEP_NAME)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(this.getClass().getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withOutputMetaData(new QFunctionOutputMetaData()
|
||||
.withField(new QFieldMetaData(FIELD_SOURCE_FILE_PATHS, QFieldType.STRING))));
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ package com.kingsrook.qqq.backend.module.filesystem.processes.implementations.fi
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -68,8 +67,7 @@ public class FilesystemSyncProcess
|
||||
.withName(FilesystemSyncStep.STEP_NAME)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(FilesystemSyncStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.addField(new QFieldMetaData(FIELD_SOURCE_TABLE, QFieldType.STRING))
|
||||
.addField(new QFieldMetaData(FIELD_ARCHIVE_TABLE, QFieldType.STRING))
|
||||
|
@ -22,16 +22,15 @@
|
||||
package com.kingsrook.qqq.backend.module.filesystem.local.actions;
|
||||
|
||||
|
||||
import java.util.function.Function;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.module.filesystem.TestUtils;
|
||||
import com.kingsrook.qqq.backend.module.filesystem.base.FilesystemRecordBackendDetailFields;
|
||||
import com.kingsrook.qqq.backend.module.filesystem.base.actions.AbstractPostReadFileCustomizer;
|
||||
import com.kingsrook.qqq.backend.module.filesystem.base.actions.FilesystemTableCustomizers;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -70,7 +69,7 @@ public class FilesystemQueryActionTest extends FilesystemActionTest
|
||||
QInstance instance = TestUtils.defineInstance();
|
||||
|
||||
QTableMetaData table = instance.getTable(TestUtils.TABLE_NAME_PERSON_LOCAL_FS_JSON);
|
||||
table.withCustomizer(FilesystemTableCustomizers.POST_READ_FILE.getRole(), new QCodeReference(ValueUpshifter.class, QCodeUsage.CUSTOMIZER));
|
||||
table.withCustomizer(FilesystemTableCustomizers.POST_READ_FILE.getRole(), new QCodeReference(ValueUpshifter.class));
|
||||
reInitInstanceInContext(instance);
|
||||
|
||||
queryInput.setTableName(TestUtils.defineLocalFilesystemJSONPersonTable().getName());
|
||||
@ -83,10 +82,10 @@ public class FilesystemQueryActionTest extends FilesystemActionTest
|
||||
|
||||
|
||||
|
||||
public static class ValueUpshifter implements Function<String, String>
|
||||
public static class ValueUpshifter extends AbstractPostReadFileCustomizer
|
||||
{
|
||||
@Override
|
||||
public String apply(String s)
|
||||
public String customizeFileContents(String s)
|
||||
{
|
||||
return (s.replaceAll("kingsrook.com", "KINGSROOK.COM"));
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import com.kingsrook.qqq.backend.core.model.actions.scripts.ExecuteCodeOutput;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
|
||||
@ -53,7 +52,7 @@ class ExecuteCodeActionTest extends BaseTest
|
||||
void testHelloWorld() throws QException
|
||||
{
|
||||
ExecuteCodeInput input = new ExecuteCodeInput()
|
||||
.withCodeReference(new QCodeReference("helloWorld.js", QCodeType.JAVA_SCRIPT, QCodeUsage.CUSTOMIZER)
|
||||
.withCodeReference(new QCodeReference("helloWorld.js", QCodeType.JAVA_SCRIPT)
|
||||
.withInlineCode("""
|
||||
return "Hello, " + input"""))
|
||||
.withContext("input", "World");
|
||||
@ -256,7 +255,7 @@ class ExecuteCodeActionTest extends BaseTest
|
||||
TestOutput testOutput = new TestOutput();
|
||||
|
||||
ExecuteCodeInput input = new ExecuteCodeInput();
|
||||
input.setCodeReference(new QCodeReference("test.js", QCodeType.JAVA_SCRIPT, QCodeUsage.CUSTOMIZER).withInlineCode(code));
|
||||
input.setCodeReference(new QCodeReference("test.js", QCodeType.JAVA_SCRIPT).withInlineCode(code));
|
||||
input.withContext("input", testInput);
|
||||
input.withContext("output", testOutput);
|
||||
|
||||
|
@ -43,7 +43,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.authentication.Auth0AuthenticationMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
@ -193,7 +192,7 @@ public class TestUtils
|
||||
.withField(new QFieldMetaData("cost", QFieldType.DECIMAL).withDisplayFormat(DisplayFormat.CURRENCY))
|
||||
.withField(new QFieldMetaData("price", QFieldType.DECIMAL).withDisplayFormat(DisplayFormat.CURRENCY));
|
||||
|
||||
table.withCustomizer(TableCustomizers.PRE_INSERT_RECORD.getRole(), new QCodeReference(PersonPreInsertCustomizer.class, QCodeUsage.CUSTOMIZER));
|
||||
table.withCustomizer(TableCustomizers.PRE_INSERT_RECORD.getRole(), new QCodeReference(PersonPreInsertCustomizer.class));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// make some changes to this table in the "main" api (but leave it like the backend in the ALTERNATIVE_API_NAME) //
|
||||
|
@ -42,7 +42,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.authentication.QAuthenticationMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
@ -174,7 +173,7 @@ public class TestUtils
|
||||
{
|
||||
qInstance.addWidget(new QWidgetMetaData()
|
||||
.withName(PersonsByCreateDateBarChart.class.getSimpleName())
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class, null)));
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -248,7 +247,7 @@ public class TestUtils
|
||||
.withAssociatedScript(new AssociatedScript()
|
||||
.withFieldName("testScriptId")
|
||||
.withScriptTypeId(1)
|
||||
.withScriptTester(new QCodeReference(TestScriptAction.class, QCodeUsage.SCRIPT_TESTER)));
|
||||
.withScriptTester(new QCodeReference(TestScriptAction.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -280,8 +279,7 @@ public class TestUtils
|
||||
.withName("prepare")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
@ -319,8 +317,7 @@ public class TestUtils
|
||||
.withName("doWork")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
@ -441,8 +438,7 @@ public class TestUtils
|
||||
.withName(STEP_NAME_SLEEPER)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(SleeperStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.addField(new QFieldMetaData(SleeperStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
}
|
||||
@ -499,8 +495,7 @@ public class TestUtils
|
||||
.withName(STEP_NAME_THROWER)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(ThrowerStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.addField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.authentication.QAuthenticationMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
|
||||
@ -169,8 +168,7 @@ public class TestUtils
|
||||
.withName("prepare")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName("person"))
|
||||
.withFieldList(List.of(
|
||||
|
@ -41,7 +41,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.authentication.QAuthenticat
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.branding.QBrandingMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QuickSightChartMetaData;
|
||||
@ -156,7 +155,7 @@ public class SampleMetaDataProvider
|
||||
{
|
||||
qInstance.addWidget(new QWidgetMetaData()
|
||||
.withName(PersonsByCreateDateBarChart.class.getSimpleName())
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class, null)));
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class)));
|
||||
|
||||
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
|
||||
String accountId = interpreter.interpret("${env.QUICKSIGHT_ACCOUNT_ID}");
|
||||
@ -173,7 +172,7 @@ public class SampleMetaDataProvider
|
||||
.withRegion(Regions.US_EAST_2.getName())
|
||||
.withName(QuickSightChartRenderer.class.getSimpleName())
|
||||
.withLabel("Example Quicksight Chart")
|
||||
.withCodeReference(new QCodeReference(QuickSightChartRenderer.class, null));
|
||||
.withCodeReference(new QCodeReference(QuickSightChartRenderer.class));
|
||||
|
||||
qInstance.addWidget(quickSightChartMetaData);
|
||||
}
|
||||
@ -418,8 +417,7 @@ public class SampleMetaDataProvider
|
||||
.withName("doWork")
|
||||
.withCode(new QCodeReference()
|
||||
.withName(MockBackendStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP)) // todo - needed, or implied in this context?
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
|
||||
.withFieldList(List.of(
|
||||
@ -561,8 +559,7 @@ public class SampleMetaDataProvider
|
||||
.withName(STEP_NAME_SLEEPER)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(SleeperStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(SleeperStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
}
|
||||
@ -619,8 +616,7 @@ public class SampleMetaDataProvider
|
||||
.withName(STEP_NAME_THROWER)
|
||||
.withCode(new QCodeReference()
|
||||
.withName(ThrowerStep.class.getName())
|
||||
.withCodeType(QCodeType.JAVA)
|
||||
.withCodeUsage(QCodeUsage.BACKEND_STEP))
|
||||
.withCodeType(QCodeType.JAVA))
|
||||
.withInputData(new QFunctionInputMetaData()
|
||||
.withField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
|
||||
}
|
||||
|
Reference in New Issue
Block a user