mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
QQQ-16 Checkpoint iteration on qqq processes
This commit is contained in:
@ -37,7 +37,6 @@ import com.kingsrook.qqq.backend.core.model.metadata.QFieldMetaData;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionInputMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionInputMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QRecordListMetaData;
|
|
||||||
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ public class RunFunctionAction
|
|||||||
ActionHelper.validateSession(runFunctionRequest);
|
ActionHelper.validateSession(runFunctionRequest);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// todo - shouldn't meta-data validation catch this? //
|
//
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
QProcessMetaData process = runFunctionRequest.getInstance().getProcess(runFunctionRequest.getProcessName());
|
QProcessMetaData process = runFunctionRequest.getInstance().getProcess(runFunctionRequest.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
@ -92,6 +91,10 @@ public class RunFunctionAction
|
|||||||
private void ensureInputFieldsAreInRequest(RunFunctionRequest runFunctionRequest, QFunctionMetaData function)
|
private void ensureInputFieldsAreInRequest(RunFunctionRequest runFunctionRequest, QFunctionMetaData function)
|
||||||
{
|
{
|
||||||
QFunctionInputMetaData inputMetaData = function.getInputMetaData();
|
QFunctionInputMetaData inputMetaData = function.getInputMetaData();
|
||||||
|
if (inputMetaData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<QFieldMetaData> fieldsToGet = new ArrayList<>();
|
List<QFieldMetaData> fieldsToGet = new ArrayList<>();
|
||||||
for(QFieldMetaData field : inputMetaData.getFieldList())
|
for(QFieldMetaData field : inputMetaData.getFieldList())
|
||||||
@ -124,8 +127,7 @@ public class RunFunctionAction
|
|||||||
private void ensureRecordsAreInRequest(RunFunctionRequest runFunctionRequest, QFunctionMetaData function) throws QException
|
private void ensureRecordsAreInRequest(RunFunctionRequest runFunctionRequest, QFunctionMetaData function) throws QException
|
||||||
{
|
{
|
||||||
QFunctionInputMetaData inputMetaData = function.getInputMetaData();
|
QFunctionInputMetaData inputMetaData = function.getInputMetaData();
|
||||||
QRecordListMetaData recordListMetaData = inputMetaData.getRecordListMetaData();
|
if(inputMetaData != null && inputMetaData.getRecordListMetaData() != null)
|
||||||
if(recordListMetaData != null)
|
|
||||||
{
|
{
|
||||||
if(CollectionUtils.nullSafeIsEmpty(runFunctionRequest.getRecords()))
|
if(CollectionUtils.nullSafeIsEmpty(runFunctionRequest.getRecords()))
|
||||||
{
|
{
|
||||||
@ -157,8 +159,8 @@ public class RunFunctionAction
|
|||||||
{
|
{
|
||||||
runFunctionResult.seedFromRequest(runFunctionRequest);
|
runFunctionResult.seedFromRequest(runFunctionRequest);
|
||||||
|
|
||||||
Class<?> codeClass = Class.forName(code.getName());
|
Class<?> codeClass = Class.forName(code.getName());
|
||||||
Object codeObject = codeClass.getConstructor().newInstance();
|
Object codeObject = codeClass.getConstructor().newInstance();
|
||||||
if(!(codeObject instanceof FunctionBody functionBodyCodeObject))
|
if(!(codeObject instanceof FunctionBody functionBodyCodeObject))
|
||||||
{
|
{
|
||||||
throw (new QException("The supplied code [" + codeClass.getName() + "] is not an instance of FunctionBody"));
|
throw (new QException("The supplied code [" + codeClass.getName() + "] is not an instance of FunctionBody"));
|
||||||
|
@ -50,9 +50,6 @@ public class RunProcessAction
|
|||||||
{
|
{
|
||||||
ActionHelper.validateSession(runProcessRequest);
|
ActionHelper.validateSession(runProcessRequest);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
|
||||||
// todo - shouldn't meta-data validation catch this? //
|
|
||||||
///////////////////////////////////////////////////////
|
|
||||||
QProcessMetaData process = runProcessRequest.getInstance().getProcess(runProcessRequest.getProcessName());
|
QProcessMetaData process = runProcessRequest.getInstance().getProcess(runProcessRequest.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
{
|
{
|
||||||
@ -61,7 +58,7 @@ public class RunProcessAction
|
|||||||
|
|
||||||
RunProcessResult runProcessResult = new RunProcessResult();
|
RunProcessResult runProcessResult = new RunProcessResult();
|
||||||
|
|
||||||
UUIDStateKey stateKey = new UUIDStateKey();
|
UUIDStateKey stateKey = new UUIDStateKey();
|
||||||
RunFunctionResult lastFunctionResult = null;
|
RunFunctionResult lastFunctionResult = null;
|
||||||
|
|
||||||
// todo - custom routing?
|
// todo - custom routing?
|
||||||
@ -70,8 +67,18 @@ public class RunProcessAction
|
|||||||
{
|
{
|
||||||
RunFunctionRequest runFunctionRequest = new RunFunctionRequest(runProcessRequest.getInstance());
|
RunFunctionRequest runFunctionRequest = new RunFunctionRequest(runProcessRequest.getInstance());
|
||||||
|
|
||||||
if(lastFunctionResult != null)
|
if(lastFunctionResult == null)
|
||||||
{
|
{
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// for the first request, load state from the run process request to prime the run function request. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
primeFunction(runProcessRequest, runFunctionRequest);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// for functions after the first one, load from state management to prime the request //
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
loadState(stateKey, runFunctionRequest);
|
loadState(stateKey, runFunctionRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +130,17 @@ public class RunProcessAction
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Copy data (the state) down from the run-process request, down into the run-
|
||||||
|
** function request.
|
||||||
|
*******************************************************************************/
|
||||||
|
private void primeFunction(RunProcessRequest runProcessRequest, RunFunctionRequest runFunctionRequest)
|
||||||
|
{
|
||||||
|
runFunctionRequest.seedFromRunProcessRequest(runProcessRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Load the process state into a function request from the state provider
|
** Load the process state into a function request from the state provider
|
||||||
**
|
**
|
||||||
|
@ -26,6 +26,8 @@ import java.util.Locale;
|
|||||||
import com.kingsrook.qqq.backend.core.model.metadata.QFieldMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.QFieldMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.QTableMetaData;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionMetaData;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
import com.kingsrook.qqq.backend.core.utils.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
@ -41,10 +43,15 @@ public class QInstanceEnricher
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void enrich(QInstance qInstance)
|
public void enrich(QInstance qInstance)
|
||||||
{
|
{
|
||||||
if (qInstance.getTables() != null)
|
if(qInstance.getTables() != null)
|
||||||
{
|
{
|
||||||
qInstance.getTables().values().forEach(this::enrich);
|
qInstance.getTables().values().forEach(this::enrich);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(qInstance.getProcesses() != null)
|
||||||
|
{
|
||||||
|
qInstance.getProcesses().values().forEach(this::enrich);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +66,7 @@ public class QInstanceEnricher
|
|||||||
table.setLabel(nameToLabel(table.getName()));
|
table.setLabel(nameToLabel(table.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table.getFields() != null)
|
if(table.getFields() != null)
|
||||||
{
|
{
|
||||||
table.getFields().values().forEach(this::enrich);
|
table.getFields().values().forEach(this::enrich);
|
||||||
}
|
}
|
||||||
@ -67,6 +74,40 @@ public class QInstanceEnricher
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
private void enrich(QProcessMetaData process)
|
||||||
|
{
|
||||||
|
if(!StringUtils.hasContent(process.getLabel()))
|
||||||
|
{
|
||||||
|
process.setLabel(nameToLabel(process.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(process.getFunctionList() != null)
|
||||||
|
{
|
||||||
|
process.getFunctionList().forEach(this::enrich);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
private void enrich(QFunctionMetaData function)
|
||||||
|
{
|
||||||
|
if(!StringUtils.hasContent(function.getLabel()))
|
||||||
|
{
|
||||||
|
function.setLabel(nameToLabel(function.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
function.getInputFields().forEach(this::enrich);
|
||||||
|
function.getOutputFields().forEach(this::enrich);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
package com.kingsrook.qqq.backend.core.interfaces;
|
package com.kingsrook.qqq.backend.core.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunFunctionRequest;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunFunctionRequest;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunFunctionResult;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunFunctionResult;
|
||||||
|
|
||||||
@ -34,5 +35,5 @@ public interface FunctionBody
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** TODO - document!
|
** TODO - document!
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void run(RunFunctionRequest runFunctionRequest, RunFunctionResult runFunctionResult);
|
void run(RunFunctionRequest runFunctionRequest, RunFunctionResult runFunctionResult) throws QException;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.model.actions.metadata;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractQResult;
|
import com.kingsrook.qqq.backend.core.model.actions.AbstractQResult;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendProcessMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendTableMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendTableMetaData;
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +34,8 @@ import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendTableMeta
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class MetaDataResult extends AbstractQResult
|
public class MetaDataResult extends AbstractQResult
|
||||||
{
|
{
|
||||||
Map<String, QFrontendTableMetaData> tables;
|
Map<String, QFrontendTableMetaData> tables;
|
||||||
|
Map<String, QFrontendProcessMetaData> processes;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -56,4 +58,26 @@ public class MetaDataResult extends AbstractQResult
|
|||||||
{
|
{
|
||||||
this.tables = tables;
|
this.tables = tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for processes
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public Map<String, QFrontendProcessMetaData> getProcesses()
|
||||||
|
{
|
||||||
|
return processes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Setter for processes
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public void setProcesses(Map<String, QFrontendProcessMetaData> processes)
|
||||||
|
{
|
||||||
|
this.processes = processes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ import com.kingsrook.qqq.backend.core.model.metadata.processes.QFunctionMetaData
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class RunFunctionRequest extends AbstractQRequest
|
public class RunFunctionRequest extends AbstractQRequest
|
||||||
{
|
{
|
||||||
private ProcessState processState;
|
private ProcessState processState;
|
||||||
private String processName;
|
private String processName;
|
||||||
private String functionName;
|
private String functionName;
|
||||||
private QProcessCallback callback;
|
private QProcessCallback callback;
|
||||||
|
|
||||||
|
|
||||||
@ -78,6 +78,16 @@ public class RunFunctionRequest extends AbstractQRequest
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public void seedFromRunProcessRequest(RunProcessRequest runProcessRequest)
|
||||||
|
{
|
||||||
|
this.processState = runProcessRequest.getProcessState();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -23,7 +23,6 @@ package com.kingsrook.qqq.backend.core.model.actions.processes;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.kingsrook.qqq.backend.core.callbacks.QProcessCallback;
|
import com.kingsrook.qqq.backend.core.callbacks.QProcessCallback;
|
||||||
@ -40,9 +39,8 @@ import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
|||||||
public class RunProcessRequest extends AbstractQRequest
|
public class RunProcessRequest extends AbstractQRequest
|
||||||
{
|
{
|
||||||
private String processName;
|
private String processName;
|
||||||
private List<QRecord> records;
|
|
||||||
private Map<String, Serializable> values;
|
|
||||||
private QProcessCallback callback;
|
private QProcessCallback callback;
|
||||||
|
private ProcessState processState;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +49,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public RunProcessRequest()
|
public RunProcessRequest()
|
||||||
{
|
{
|
||||||
|
processState = new ProcessState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,6 +60,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
public RunProcessRequest(QInstance instance)
|
public RunProcessRequest(QInstance instance)
|
||||||
{
|
{
|
||||||
super(instance);
|
super(instance);
|
||||||
|
processState = new ProcessState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public List<QRecord> getRecords()
|
public List<QRecord> getRecords()
|
||||||
{
|
{
|
||||||
return records;
|
return processState.getRecords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void setRecords(List<QRecord> records)
|
public void setRecords(List<QRecord> records)
|
||||||
{
|
{
|
||||||
this.records = records;
|
this.processState.setRecords(records);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public RunProcessRequest withRecords(List<QRecord> records)
|
public RunProcessRequest withRecords(List<QRecord> records)
|
||||||
{
|
{
|
||||||
this.records = records;
|
setRecords(records);
|
||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public Map<String, Serializable> getValues()
|
public Map<String, Serializable> getValues()
|
||||||
{
|
{
|
||||||
return values;
|
return this.processState.getValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void setValues(Map<String, Serializable> values)
|
public void setValues(Map<String, Serializable> values)
|
||||||
{
|
{
|
||||||
this.values = values;
|
this.processState.setValues(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public RunProcessRequest withValues(Map<String, Serializable> values)
|
public RunProcessRequest withValues(Map<String, Serializable> values)
|
||||||
{
|
{
|
||||||
this.values = values;
|
this.processState.setValues(values);
|
||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,11 +183,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public RunProcessRequest addValue(String fieldName, Serializable value)
|
public RunProcessRequest addValue(String fieldName, Serializable value)
|
||||||
{
|
{
|
||||||
if(this.values == null)
|
this.processState.getValues().put(fieldName, value);
|
||||||
{
|
|
||||||
this.values = new HashMap<>();
|
|
||||||
}
|
|
||||||
this.values.put(fieldName, value);
|
|
||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,11 +229,7 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public Serializable getValue(String fieldName)
|
public Serializable getValue(String fieldName)
|
||||||
{
|
{
|
||||||
if(values == null)
|
return (this.processState.getValues().get(fieldName));
|
||||||
{
|
|
||||||
return (null);
|
|
||||||
}
|
|
||||||
return (values.get(fieldName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,4 +254,15 @@ public class RunProcessRequest extends AbstractQRequest
|
|||||||
return ((Integer) getValue(fieldName));
|
return ((Integer) getValue(fieldName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Accessor for processState - protected, because we generally want to access
|
||||||
|
** its members through wrapper methods, we think
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
protected ProcessState getProcessState()
|
||||||
|
{
|
||||||
|
return processState;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -22,7 +22,10 @@
|
|||||||
package com.kingsrook.qqq.backend.core.model.metadata.processes;
|
package com.kingsrook.qqq.backend.core.model.metadata.processes;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QCodeReference;
|
import com.kingsrook.qqq.backend.core.model.metadata.QCodeReference;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.QFieldMetaData;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -31,12 +34,12 @@ import com.kingsrook.qqq.backend.core.model.metadata.QCodeReference;
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QFunctionMetaData
|
public class QFunctionMetaData
|
||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String label;
|
||||||
private QFunctionInputMetaData inputMetaData;
|
private QFunctionInputMetaData inputMetaData;
|
||||||
private QFunctionOutputMetaData outputMetaData;
|
private QFunctionOutputMetaData outputMetaData;
|
||||||
private QCodeReference code;
|
private QCodeReference code;
|
||||||
private QOutputView outputView;
|
private QOutputView outputView;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ public class QFunctionMetaData
|
|||||||
public QFunctionMetaData withOutputMetaData(QFunctionOutputMetaData outputMetaData)
|
public QFunctionMetaData withOutputMetaData(QFunctionOutputMetaData outputMetaData)
|
||||||
{
|
{
|
||||||
this.outputMetaData = outputMetaData;
|
this.outputMetaData = outputMetaData;
|
||||||
return(this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -241,4 +244,35 @@ public class QFunctionMetaData
|
|||||||
this.outputView = outputView;
|
this.outputView = outputView;
|
||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Get a list of all of the input fields used by this function
|
||||||
|
*******************************************************************************/
|
||||||
|
public List<QFieldMetaData> getInputFields()
|
||||||
|
{
|
||||||
|
List<QFieldMetaData> rs = new ArrayList<>();
|
||||||
|
if(inputMetaData != null && inputMetaData.getFieldList() != null)
|
||||||
|
{
|
||||||
|
rs.addAll(inputMetaData.getFieldList());
|
||||||
|
}
|
||||||
|
return (rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Get a list of all of the output fields used by this function
|
||||||
|
*******************************************************************************/
|
||||||
|
public List<QFieldMetaData> getOutputFields()
|
||||||
|
{
|
||||||
|
List<QFieldMetaData> rs = new ArrayList<>();
|
||||||
|
if(outputMetaData != null && outputMetaData.getFieldList() != null)
|
||||||
|
{
|
||||||
|
rs.addAll(outputMetaData.getFieldList());
|
||||||
|
}
|
||||||
|
return (rs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.model.metadata.processes;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.QFieldMetaData;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -32,8 +33,9 @@ import java.util.List;
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class QProcessMetaData
|
public class QProcessMetaData
|
||||||
{
|
{
|
||||||
private String name;
|
private String name;
|
||||||
private String tableName;
|
private String label;
|
||||||
|
private String tableName;
|
||||||
private List<QFunctionMetaData> functionList;
|
private List<QFunctionMetaData> functionList;
|
||||||
|
|
||||||
|
|
||||||
@ -70,6 +72,42 @@ public class QProcessMetaData
|
|||||||
return (this);
|
return (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Getter for label
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public String getLabel()
|
||||||
|
{
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Setter for label
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public void setLabel(String label)
|
||||||
|
{
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Setter for label
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
public QProcessMetaData withLabel(String label)
|
||||||
|
{
|
||||||
|
this.label = label;
|
||||||
|
return (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Getter for tableName
|
** Getter for tableName
|
||||||
**
|
**
|
||||||
@ -169,4 +207,40 @@ public class QProcessMetaData
|
|||||||
|
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Get a list of all of the input fields used by all the functions in this process.
|
||||||
|
*******************************************************************************/
|
||||||
|
public List<QFieldMetaData> getInputFields()
|
||||||
|
{
|
||||||
|
List<QFieldMetaData> rs = new ArrayList<>();
|
||||||
|
if(functionList != null)
|
||||||
|
{
|
||||||
|
for(QFunctionMetaData function : functionList)
|
||||||
|
{
|
||||||
|
rs.addAll(function.getInputFields());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Get a list of all of the output fields used by all the functions in this process.
|
||||||
|
*******************************************************************************/
|
||||||
|
public List<QFieldMetaData> getOutputFields()
|
||||||
|
{
|
||||||
|
List<QFieldMetaData> rs = new ArrayList<>();
|
||||||
|
if(functionList != null)
|
||||||
|
{
|
||||||
|
for(QFunctionMetaData function : functionList)
|
||||||
|
{
|
||||||
|
rs.addAll(function.getOutputFields());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (rs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ import com.kingsrook.qqq.backend.core.modules.mock.MockAuthenticationModule;
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class TestUtils
|
public class TestUtils
|
||||||
{
|
{
|
||||||
|
public static String DEFAULT_BACKEND_NAME = "default";
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Define the instance used in standard tests.
|
** Define the instance used in standard tests.
|
||||||
**
|
**
|
||||||
@ -102,7 +104,7 @@ public class TestUtils
|
|||||||
public static QBackendMetaData defineBackend()
|
public static QBackendMetaData defineBackend()
|
||||||
{
|
{
|
||||||
return new QBackendMetaData()
|
return new QBackendMetaData()
|
||||||
.withName("default")
|
.withName(DEFAULT_BACKEND_NAME)
|
||||||
.withBackendType("mock");
|
.withBackendType("mock");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user