mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
Remove all calls to actionInput.getInstance and getSesssion, in favor of the equivallent methods from QContext
This commit is contained in:
@ -28,6 +28,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QRuntimeException;
|
import com.kingsrook.qqq.backend.core.exceptions.QRuntimeException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
|
||||||
@ -97,7 +98,7 @@ public abstract class ChildInserterPostInsertCustomizer extends AbstractPostInse
|
|||||||
List<QRecord> rs = records;
|
List<QRecord> rs = records;
|
||||||
List<QRecord> childrenToInsert = new ArrayList<>();
|
List<QRecord> childrenToInsert = new ArrayList<>();
|
||||||
QTableMetaData table = getInsertInput().getTable();
|
QTableMetaData table = getInsertInput().getTable();
|
||||||
QTableMetaData childTable = getInsertInput().getInstance().getTable(getChildTableName());
|
QTableMetaData childTable = QContext.getQInstance().getTable(getChildTableName());
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// iterate over the inserted records, building a list child records to insert //
|
// iterate over the inserted records, building a list child records to insert //
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.SearchPossibleValueSourceAction;
|
import com.kingsrook.qqq.backend.core.actions.values.SearchPossibleValueSourceAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
|
||||||
@ -102,7 +103,7 @@ public abstract class AbstractWidgetRenderer
|
|||||||
String possibleValueSourceName = dropdownData.getPossibleValueSourceName();
|
String possibleValueSourceName = dropdownData.getPossibleValueSourceName();
|
||||||
if(possibleValueSourceName != null)
|
if(possibleValueSourceName != null)
|
||||||
{
|
{
|
||||||
QPossibleValueSource possibleValueSource = input.getInstance().getPossibleValueSource(possibleValueSourceName);
|
QPossibleValueSource possibleValueSource = QContext.getQInstance().getPossibleValueSource(possibleValueSourceName);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// this looks complicated, but is just look for a label in the dropdown data and if found use it, //
|
// this looks complicated, but is just look for a label in the dropdown data and if found use it, //
|
||||||
|
@ -34,6 +34,7 @@ import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -181,10 +182,10 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
|||||||
{
|
{
|
||||||
String widgetLabel = input.getQueryParams().get("widgetLabel");
|
String widgetLabel = input.getQueryParams().get("widgetLabel");
|
||||||
String joinName = input.getQueryParams().get("joinName");
|
String joinName = input.getQueryParams().get("joinName");
|
||||||
QJoinMetaData join = input.getInstance().getJoin(joinName);
|
QJoinMetaData join = QContext.getQInstance().getJoin(joinName);
|
||||||
String id = input.getQueryParams().get("id");
|
String id = input.getQueryParams().get("id");
|
||||||
QTableMetaData leftTable = input.getInstance().getTable(join.getLeftTable());
|
QTableMetaData leftTable = QContext.getQInstance().getTable(join.getLeftTable());
|
||||||
QTableMetaData rightTable = input.getInstance().getTable(join.getRightTable());
|
QTableMetaData rightTable = QContext.getQInstance().getTable(join.getRightTable());
|
||||||
|
|
||||||
Integer maxRows = null;
|
Integer maxRows = null;
|
||||||
if(StringUtils.hasContent(input.getQueryParams().get("maxRows")))
|
if(StringUtils.hasContent(input.getQueryParams().get("maxRows")))
|
||||||
@ -252,7 +253,7 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String tablePath = input.getInstance().getTablePath(rightTable.getName());
|
String tablePath = QContext.getQInstance().getTablePath(rightTable.getName());
|
||||||
String viewAllLink = tablePath == null ? null : (tablePath + "?filter=" + URLEncoder.encode(JsonUtils.toJson(filter), Charset.defaultCharset()));
|
String viewAllLink = tablePath == null ? null : (tablePath + "?filter=" + URLEncoder.encode(JsonUtils.toJson(filter), Charset.defaultCharset()));
|
||||||
|
|
||||||
ChildRecordListData widgetData = new ChildRecordListData(widgetLabel, queryOutput, rightTable, tablePath, viewAllLink, totalRows);
|
ChildRecordListData widgetData = new ChildRecordListData(widgetLabel, queryOutput, rightTable, tablePath, viewAllLink, totalRows);
|
||||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||||
@ -57,7 +58,7 @@ public class ProcessWidgetRenderer extends AbstractWidgetRenderer
|
|||||||
setupDropdowns(input, widgetMetaData, data);
|
setupDropdowns(input, widgetMetaData, data);
|
||||||
|
|
||||||
String processName = (String) widgetMetaData.getDefaultValues().get(WIDGET_PROCESS_NAME);
|
String processName = (String) widgetMetaData.getDefaultValues().get(WIDGET_PROCESS_NAME);
|
||||||
QProcessMetaData processMetaData = input.getInstance().getProcess(processName);
|
QProcessMetaData processMetaData = QContext.getQInstance().getProcess(processName);
|
||||||
data.setProcessMetaData(processMetaData);
|
data.setProcessMetaData(processMetaData);
|
||||||
|
|
||||||
data.setDefaultValues(new HashMap<>(input.getQueryParams()));
|
data.setDefaultValues(new HashMap<>(input.getQueryParams()));
|
||||||
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionCheckResult;
|
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionCheckResult;
|
||||||
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionsHelper;
|
import com.kingsrook.qqq.backend.core.actions.permissions.PermissionsHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput;
|
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.metadata.MetaDataOutput;
|
||||||
@ -72,7 +73,7 @@ public class MetaDataAction
|
|||||||
// map tables to frontend metadata //
|
// map tables to frontend metadata //
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
Map<String, QFrontendTableMetaData> tables = new LinkedHashMap<>();
|
Map<String, QFrontendTableMetaData> tables = new LinkedHashMap<>();
|
||||||
for(Map.Entry<String, QTableMetaData> entry : metaDataInput.getInstance().getTables().entrySet())
|
for(Map.Entry<String, QTableMetaData> entry : QContext.getQInstance().getTables().entrySet())
|
||||||
{
|
{
|
||||||
String tableName = entry.getKey();
|
String tableName = entry.getKey();
|
||||||
QTableMetaData table = entry.getValue();
|
QTableMetaData table = entry.getValue();
|
||||||
@ -83,7 +84,7 @@ public class MetaDataAction
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QBackendMetaData backendForTable = metaDataInput.getInstance().getBackendForTable(tableName);
|
QBackendMetaData backendForTable = QContext.getQInstance().getBackendForTable(tableName);
|
||||||
tables.put(tableName, new QFrontendTableMetaData(metaDataInput, backendForTable, table, false, false));
|
tables.put(tableName, new QFrontendTableMetaData(metaDataInput, backendForTable, table, false, false));
|
||||||
treeNodes.put(tableName, new AppTreeNode(table));
|
treeNodes.put(tableName, new AppTreeNode(table));
|
||||||
}
|
}
|
||||||
@ -96,7 +97,7 @@ public class MetaDataAction
|
|||||||
// map processes to frontend metadata //
|
// map processes to frontend metadata //
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
Map<String, QFrontendProcessMetaData> processes = new LinkedHashMap<>();
|
Map<String, QFrontendProcessMetaData> processes = new LinkedHashMap<>();
|
||||||
for(Map.Entry<String, QProcessMetaData> entry : metaDataInput.getInstance().getProcesses().entrySet())
|
for(Map.Entry<String, QProcessMetaData> entry : QContext.getQInstance().getProcesses().entrySet())
|
||||||
{
|
{
|
||||||
String processName = entry.getKey();
|
String processName = entry.getKey();
|
||||||
QProcessMetaData process = entry.getValue();
|
QProcessMetaData process = entry.getValue();
|
||||||
@ -116,7 +117,7 @@ public class MetaDataAction
|
|||||||
// map reports to frontend metadata //
|
// map reports to frontend metadata //
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
Map<String, QFrontendReportMetaData> reports = new LinkedHashMap<>();
|
Map<String, QFrontendReportMetaData> reports = new LinkedHashMap<>();
|
||||||
for(Map.Entry<String, QReportMetaData> entry : metaDataInput.getInstance().getReports().entrySet())
|
for(Map.Entry<String, QReportMetaData> entry : QContext.getQInstance().getReports().entrySet())
|
||||||
{
|
{
|
||||||
String reportName = entry.getKey();
|
String reportName = entry.getKey();
|
||||||
QReportMetaData report = entry.getValue();
|
QReportMetaData report = entry.getValue();
|
||||||
@ -136,7 +137,7 @@ public class MetaDataAction
|
|||||||
// map widgets to frontend metadata //
|
// map widgets to frontend metadata //
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
Map<String, QFrontendWidgetMetaData> widgets = new LinkedHashMap<>();
|
Map<String, QFrontendWidgetMetaData> widgets = new LinkedHashMap<>();
|
||||||
for(Map.Entry<String, QWidgetMetaDataInterface> entry : metaDataInput.getInstance().getWidgets().entrySet())
|
for(Map.Entry<String, QWidgetMetaDataInterface> entry : QContext.getQInstance().getWidgets().entrySet())
|
||||||
{
|
{
|
||||||
String widgetName = entry.getKey();
|
String widgetName = entry.getKey();
|
||||||
QWidgetMetaDataInterface widget = entry.getValue();
|
QWidgetMetaDataInterface widget = entry.getValue();
|
||||||
@ -154,7 +155,7 @@ public class MetaDataAction
|
|||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// sort apps - by sortOrder (integer), then by label //
|
// sort apps - by sortOrder (integer), then by label //
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
List<QAppMetaData> sortedApps = metaDataInput.getInstance().getApps().values().stream()
|
List<QAppMetaData> sortedApps = QContext.getQInstance().getApps().values().stream()
|
||||||
.sorted(Comparator.comparing((QAppMetaData a) -> a.getSortOrder())
|
.sorted(Comparator.comparing((QAppMetaData a) -> a.getSortOrder())
|
||||||
.thenComparing((QAppMetaData a) -> a.getLabel()))
|
.thenComparing((QAppMetaData a) -> a.getLabel()))
|
||||||
.toList();
|
.toList();
|
||||||
@ -211,14 +212,14 @@ public class MetaDataAction
|
|||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// add branding metadata if found //
|
// add branding metadata if found //
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
if(metaDataInput.getInstance().getBranding() != null)
|
if(QContext.getQInstance().getBranding() != null)
|
||||||
{
|
{
|
||||||
metaDataOutput.setBranding(metaDataInput.getInstance().getBranding());
|
metaDataOutput.setBranding(QContext.getQInstance().getBranding());
|
||||||
}
|
}
|
||||||
|
|
||||||
metaDataOutput.setEnvironmentValues(metaDataInput.getInstance().getEnvironmentValues());
|
metaDataOutput.setEnvironmentValues(QContext.getQInstance().getEnvironmentValues());
|
||||||
|
|
||||||
metaDataOutput.setHelpContents(metaDataInput.getInstance().getHelpContent());
|
metaDataOutput.setHelpContents(QContext.getQInstance().getHelpContent());
|
||||||
|
|
||||||
// todo post-customization - can do whatever w/ the result if you want?
|
// todo post-customization - can do whatever w/ the result if you want?
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.actions.metadata;
|
|||||||
|
|
||||||
|
|
||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.ProcessMetaDataInput;
|
import com.kingsrook.qqq.backend.core.model.actions.metadata.ProcessMetaDataInput;
|
||||||
@ -47,7 +48,7 @@ public class ProcessMetaDataAction
|
|||||||
// todo pre-customization - just get to modify the request?
|
// todo pre-customization - just get to modify the request?
|
||||||
ProcessMetaDataOutput processMetaDataOutput = new ProcessMetaDataOutput();
|
ProcessMetaDataOutput processMetaDataOutput = new ProcessMetaDataOutput();
|
||||||
|
|
||||||
QProcessMetaData process = processMetaDataInput.getInstance().getProcess(processMetaDataInput.getProcessName());
|
QProcessMetaData process = QContext.getQInstance().getProcess(processMetaDataInput.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
{
|
{
|
||||||
throw (new QNotFoundException("Process [" + processMetaDataInput.getProcessName() + "] was not found."));
|
throw (new QNotFoundException("Process [" + processMetaDataInput.getProcessName() + "] was not found."));
|
||||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.actions.metadata;
|
|||||||
|
|
||||||
|
|
||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.metadata.TableMetaDataInput;
|
import com.kingsrook.qqq.backend.core.model.actions.metadata.TableMetaDataInput;
|
||||||
@ -48,12 +49,12 @@ public class TableMetaDataAction
|
|||||||
// todo pre-customization - just get to modify the request?
|
// todo pre-customization - just get to modify the request?
|
||||||
TableMetaDataOutput tableMetaDataOutput = new TableMetaDataOutput();
|
TableMetaDataOutput tableMetaDataOutput = new TableMetaDataOutput();
|
||||||
|
|
||||||
QTableMetaData table = tableMetaDataInput.getInstance().getTable(tableMetaDataInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(tableMetaDataInput.getTableName());
|
||||||
if(table == null)
|
if(table == null)
|
||||||
{
|
{
|
||||||
throw (new QNotFoundException("Table [" + tableMetaDataInput.getTableName() + "] was not found."));
|
throw (new QNotFoundException("Table [" + tableMetaDataInput.getTableName() + "] was not found."));
|
||||||
}
|
}
|
||||||
QBackendMetaData backendForTable = tableMetaDataInput.getInstance().getBackendForTable(table.getName());
|
QBackendMetaData backendForTable = QContext.getQInstance().getBackendForTable(table.getName());
|
||||||
tableMetaDataOutput.setTable(new QFrontendTableMetaData(tableMetaDataInput, backendForTable, table, true, true));
|
tableMetaDataOutput.setTable(new QFrontendTableMetaData(tableMetaDataInput, backendForTable, table, true, true));
|
||||||
|
|
||||||
// todo post-customization - can do whatever w/ the result if you want
|
// todo post-customization - can do whatever w/ the result if you want
|
||||||
|
@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.actions.processes;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
import com.kingsrook.qqq.backend.core.actions.ActionHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QBadRequestException;
|
import com.kingsrook.qqq.backend.core.exceptions.QBadRequestException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -54,7 +55,7 @@ public class CancelProcessAction extends RunProcessAction
|
|||||||
{
|
{
|
||||||
ActionHelper.validateSession(runProcessInput);
|
ActionHelper.validateSession(runProcessInput);
|
||||||
|
|
||||||
QProcessMetaData process = runProcessInput.getInstance().getProcess(runProcessInput.getProcessName());
|
QProcessMetaData process = QContext.getQInstance().getProcess(runProcessInput.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
{
|
{
|
||||||
throw new QBadRequestException("Process [" + runProcessInput.getProcessName() + "] is not defined in this instance.");
|
throw new QBadRequestException("Process [" + runProcessInput.getProcessName() + "] is not defined in this instance.");
|
||||||
|
@ -30,6 +30,7 @@ import java.util.Objects;
|
|||||||
import java.util.stream.Collectors;
|
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.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -64,7 +65,7 @@ public class RunBackendStepAction
|
|||||||
{
|
{
|
||||||
ActionHelper.validateSession(runBackendStepInput);
|
ActionHelper.validateSession(runBackendStepInput);
|
||||||
|
|
||||||
QProcessMetaData process = runBackendStepInput.getInstance().getProcess(runBackendStepInput.getProcessName());
|
QProcessMetaData process = QContext.getQInstance().getProcess(runBackendStepInput.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
{
|
{
|
||||||
throw new QException("Process [" + runBackendStepInput.getProcessName() + "] is not defined in this instance.");
|
throw new QException("Process [" + runBackendStepInput.getProcessName() + "] is not defined in this instance.");
|
||||||
|
@ -99,7 +99,7 @@ public class RunProcessAction
|
|||||||
{
|
{
|
||||||
ActionHelper.validateSession(runProcessInput);
|
ActionHelper.validateSession(runProcessInput);
|
||||||
|
|
||||||
QProcessMetaData process = runProcessInput.getInstance().getProcess(runProcessInput.getProcessName());
|
QProcessMetaData process = QContext.getQInstance().getProcess(runProcessInput.getProcessName());
|
||||||
if(process == null)
|
if(process == null)
|
||||||
{
|
{
|
||||||
throw new QException("Process [" + runProcessInput.getProcessName() + "] is not defined in this instance.");
|
throw new QException("Process [" + runProcessInput.getProcessName() + "] is not defined in this instance.");
|
||||||
|
@ -443,7 +443,13 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
|
|||||||
queryInput.withQueryHint(QueryHint.MAY_USE_READ_ONLY_BACKEND);
|
queryInput.withQueryHint(QueryHint.MAY_USE_READ_ONLY_BACKEND);
|
||||||
|
|
||||||
queryInput.setShouldTranslatePossibleValues(true);
|
queryInput.setShouldTranslatePossibleValues(true);
|
||||||
|
<<<<<<< HEAD
|
||||||
queryInput.setFieldsToTranslatePossibleValues(setupFieldsToTranslatePossibleValues(reportInput, dataSource));
|
queryInput.setFieldsToTranslatePossibleValues(setupFieldsToTranslatePossibleValues(reportInput, dataSource));
|
||||||
|
||||||| parent of a9eb8946 (Remove all calls to actionInput.getInstance and getSesssion, in favor of the equivallent methods from QContext)
|
||||||
|
queryInput.setFieldsToTranslatePossibleValues(setupFieldsToTranslatePossibleValues(reportInput, dataSource, new JoinsContext(reportInput.getInstance(), dataSource.getSourceTable(), dataSource.getQueryJoins(), queryInput.getFilter())));
|
||||||
|
=======
|
||||||
|
queryInput.setFieldsToTranslatePossibleValues(setupFieldsToTranslatePossibleValues(reportInput, dataSource, new JoinsContext(QContext.getQInstance(), dataSource.getSourceTable(), dataSource.getQueryJoins(), queryInput.getFilter())));
|
||||||
|
>>>>>>> a9eb8946 (Remove all calls to actionInput.getInstance and getSesssion, in favor of the equivallent methods from QContext)
|
||||||
|
|
||||||
if(dataSource.getQueryInputCustomizer() != null)
|
if(dataSource.getQueryInputCustomizer() != null)
|
||||||
{
|
{
|
||||||
@ -800,6 +806,7 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
|
|||||||
List<QReportView> reportViews = views.stream().filter(v -> v.getType().equals(ReportType.SUMMARY)).toList();
|
List<QReportView> reportViews = views.stream().filter(v -> v.getType().equals(ReportType.SUMMARY)).toList();
|
||||||
for(QReportView view : reportViews)
|
for(QReportView view : reportViews)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
QReportDataSource dataSource = getDataSource(view.getDataSourceName());
|
QReportDataSource dataSource = getDataSource(view.getDataSourceName());
|
||||||
if(dataSource == null)
|
if(dataSource == null)
|
||||||
{
|
{
|
||||||
@ -808,6 +815,15 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
|
|||||||
|
|
||||||
QTableMetaData table = QContext.getQInstance().getTable(dataSource.getSourceTable());
|
QTableMetaData table = QContext.getQInstance().getTable(dataSource.getSourceTable());
|
||||||
SummaryOutput summaryOutput = computeSummaryRowsForView(reportInput, view, table);
|
SummaryOutput summaryOutput = computeSummaryRowsForView(reportInput, view, table);
|
||||||
|
||||||| parent of a9eb8946 (Remove all calls to actionInput.getInstance and getSesssion, in favor of the equivallent methods from QContext)
|
||||||
|
QReportDataSource dataSource = getDataSource(view.getDataSourceName());
|
||||||
|
QTableMetaData table = reportInput.getInstance().getTable(dataSource.getSourceTable());
|
||||||
|
SummaryOutput summaryOutput = computeSummaryRowsForView(reportInput, view, table);
|
||||||
|
=======
|
||||||
|
QReportDataSource dataSource = getDataSource(view.getDataSourceName());
|
||||||
|
QTableMetaData table = QContext.getQInstance().getTable(dataSource.getSourceTable());
|
||||||
|
SummaryOutput summaryOutput = computeSummaryRowsForView(reportInput, view, table);
|
||||||
|
>>>>>>> a9eb8946 (Remove all calls to actionInput.getInstance and getSesssion, in favor of the equivallent methods from QContext)
|
||||||
|
|
||||||
ExportInput exportInput = new ExportInput();
|
ExportInput exportInput = new ExportInput();
|
||||||
exportInput.setReportDestination(reportInput.getReportDestination());
|
exportInput.setReportDestination(reportInput.getReportDestination());
|
||||||
|
@ -124,7 +124,7 @@ public class ExcelFastexcelExportStreamer implements ExportStreamerInterface
|
|||||||
if(workbook == null)
|
if(workbook == null)
|
||||||
{
|
{
|
||||||
String appName = ObjectUtils.tryAndRequireNonNullElse(() -> QContext.getQInstance().getBranding().getAppName(), "QQQ");
|
String appName = ObjectUtils.tryAndRequireNonNullElse(() -> QContext.getQInstance().getBranding().getAppName(), "QQQ");
|
||||||
QInstance instance = exportInput.getInstance();
|
QInstance instance = QContext.getQInstance();
|
||||||
if(instance != null && instance.getBranding() != null && instance.getBranding().getCompanyName() != null)
|
if(instance != null && instance.getBranding() != null && instance.getBranding().getCompanyName() != null)
|
||||||
{
|
{
|
||||||
appName = instance.getBranding().getCompanyName();
|
appName = instance.getBranding().getCompanyName();
|
||||||
|
@ -352,7 +352,7 @@ public class GetAction
|
|||||||
{
|
{
|
||||||
if(qPossibleValueTranslator == null)
|
if(qPossibleValueTranslator == null)
|
||||||
{
|
{
|
||||||
qPossibleValueTranslator = new QPossibleValueTranslator(getInput.getInstance(), getInput.getSession());
|
qPossibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
}
|
}
|
||||||
qPossibleValueTranslator.translatePossibleValuesInRecords(getInput.getTable(), List.of(returnRecord));
|
qPossibleValueTranslator.translatePossibleValuesInRecords(getInput.getTable(), List.of(returnRecord));
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
|
|||||||
|
|
||||||
setDefaultValuesInRecords(table, insertInput.getRecords());
|
setDefaultValuesInRecords(table, insertInput.getRecords());
|
||||||
|
|
||||||
ValueBehaviorApplier.applyFieldBehaviors(ValueBehaviorApplier.Action.INSERT, insertInput.getInstance(), table, insertInput.getRecords(), null);
|
ValueBehaviorApplier.applyFieldBehaviors(ValueBehaviorApplier.Action.INSERT, QContext.getQInstance(), table, insertInput.getRecords(), null);
|
||||||
|
|
||||||
runPreInsertCustomizerIfItIsTime(insertInput, isPreview, preInsertCustomizer, AbstractPreInsertCustomizer.WhenToRun.BEFORE_UNIQUE_KEY_CHECKS);
|
runPreInsertCustomizerIfItIsTime(insertInput, isPreview, preInsertCustomizer, AbstractPreInsertCustomizer.WhenToRun.BEFORE_UNIQUE_KEY_CHECKS);
|
||||||
setErrorsIfUniqueKeyErrors(insertInput, table);
|
setErrorsIfUniqueKeyErrors(insertInput, table);
|
||||||
|
@ -297,7 +297,7 @@ public class QueryAction
|
|||||||
{
|
{
|
||||||
if(qPossibleValueTranslator == null)
|
if(qPossibleValueTranslator == null)
|
||||||
{
|
{
|
||||||
qPossibleValueTranslator = new QPossibleValueTranslator(queryInput.getInstance(), queryInput.getSession());
|
qPossibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
}
|
}
|
||||||
qPossibleValueTranslator.translatePossibleValuesInRecords(queryInput.getTable(), records, queryInput.getQueryJoins(), queryInput.getFieldsToTranslatePossibleValues());
|
qPossibleValueTranslator.translatePossibleValuesInRecords(queryInput.getTable(), records, queryInput.getQueryJoins(), queryInput.getFieldsToTranslatePossibleValues());
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class UpdateAction
|
|||||||
behaviorsToOmit = Set.of(DynamicDefaultValueBehavior.MODIFY_DATE);
|
behaviorsToOmit = Set.of(DynamicDefaultValueBehavior.MODIFY_DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueBehaviorApplier.applyFieldBehaviors(ValueBehaviorApplier.Action.UPDATE, updateInput.getInstance(), table, updateInput.getRecords(), behaviorsToOmit);
|
ValueBehaviorApplier.applyFieldBehaviors(ValueBehaviorApplier.Action.UPDATE, QContext.getQInstance(), table, updateInput.getRecords(), behaviorsToOmit);
|
||||||
validatePrimaryKeysAreGiven(updateInput);
|
validatePrimaryKeysAreGiven(updateInput);
|
||||||
|
|
||||||
if(oldRecordList.isPresent())
|
if(oldRecordList.isPresent())
|
||||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
||||||
@ -69,14 +70,14 @@ public class SearchPossibleValueSourceAction
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public SearchPossibleValueSourceOutput execute(SearchPossibleValueSourceInput input) throws QException
|
public SearchPossibleValueSourceOutput execute(SearchPossibleValueSourceInput input) throws QException
|
||||||
{
|
{
|
||||||
QInstance qInstance = input.getInstance();
|
QInstance qInstance = QContext.getQInstance();
|
||||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(input.getPossibleValueSourceName());
|
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(input.getPossibleValueSourceName());
|
||||||
if(possibleValueSource == null)
|
if(possibleValueSource == null)
|
||||||
{
|
{
|
||||||
throw new QException("Missing possible value source named [" + input.getPossibleValueSourceName() + "]");
|
throw new QException("Missing possible value source named [" + input.getPossibleValueSourceName() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleValueTranslator = new QPossibleValueTranslator(input.getInstance(), input.getSession());
|
possibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
SearchPossibleValueSourceOutput output = null;
|
SearchPossibleValueSourceOutput output = null;
|
||||||
if(possibleValueSource.getType().equals(QPossibleValueSourceType.ENUM))
|
if(possibleValueSource.getType().equals(QPossibleValueSourceType.ENUM))
|
||||||
{
|
{
|
||||||
@ -199,7 +200,7 @@ public class SearchPossibleValueSourceAction
|
|||||||
QueryInput queryInput = new QueryInput();
|
QueryInput queryInput = new QueryInput();
|
||||||
queryInput.setTableName(possibleValueSource.getTableName());
|
queryInput.setTableName(possibleValueSource.getTableName());
|
||||||
|
|
||||||
QTableMetaData table = input.getInstance().getTable(possibleValueSource.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(possibleValueSource.getTableName());
|
||||||
|
|
||||||
QQueryFilter queryFilter = new QQueryFilter();
|
QQueryFilter queryFilter = new QQueryFilter();
|
||||||
queryFilter.setBooleanOperator(QQueryFilter.BooleanOperator.OR);
|
queryFilter.setBooleanOperator(QQueryFilter.BooleanOperator.OR);
|
||||||
|
@ -27,13 +27,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobCallback;
|
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobCallback;
|
||||||
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobStatus;
|
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobStatus;
|
||||||
import com.kingsrook.qqq.backend.core.actions.async.NonPersistedAsyncJobCallback;
|
import com.kingsrook.qqq.backend.core.actions.async.NonPersistedAsyncJobCallback;
|
||||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QInstanceValidationException;
|
import com.kingsrook.qqq.backend.core.exceptions.QInstanceValidationException;
|
||||||
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
|
import com.kingsrook.qqq.backend.core.instances.QInstanceValidator;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
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.authentication.QAuthenticationMetaData;
|
|
||||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -93,45 +90,6 @@ public class AbstractActionInput
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
@JsonIgnore
|
|
||||||
public QAuthenticationMetaData getAuthenticationMetaData()
|
|
||||||
{
|
|
||||||
return (getInstance().getAuthentication());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
** Getter for instance
|
|
||||||
**
|
|
||||||
** Deprecated. Please use QContext.getInstance() instead
|
|
||||||
*******************************************************************************/
|
|
||||||
@JsonIgnore
|
|
||||||
@Deprecated
|
|
||||||
public QInstance getInstance()
|
|
||||||
{
|
|
||||||
return (QContext.getQInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
** Getter for session
|
|
||||||
**
|
|
||||||
** Deprecated. Please use QContext.getSession() instead
|
|
||||||
*******************************************************************************/
|
|
||||||
@JsonIgnore
|
|
||||||
@Deprecated
|
|
||||||
public QSession getSession()
|
|
||||||
{
|
|
||||||
return (QContext.getQSession());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Getter for asyncJobCallback
|
** Getter for asyncJobCallback
|
||||||
**
|
**
|
||||||
|
@ -168,11 +168,11 @@ public class QFrontendTableMetaData
|
|||||||
editPermission = PermissionsHelper.hasTablePermission(actionInput, tableMetaData.getName(), TablePermissionSubType.EDIT);
|
editPermission = PermissionsHelper.hasTablePermission(actionInput, tableMetaData.getName(), TablePermissionSubType.EDIT);
|
||||||
deletePermission = PermissionsHelper.hasTablePermission(actionInput, tableMetaData.getName(), TablePermissionSubType.DELETE);
|
deletePermission = PermissionsHelper.hasTablePermission(actionInput, tableMetaData.getName(), TablePermissionSubType.DELETE);
|
||||||
|
|
||||||
QBackendMetaData backend = actionInput.getInstance().getBackend(tableMetaData.getBackendName());
|
QBackendMetaData backend = QContext.getQInstance().getBackend(tableMetaData.getBackendName());
|
||||||
if(backend != null && backend.getUsesVariants())
|
if(backend != null && backend.getUsesVariants())
|
||||||
{
|
{
|
||||||
usesVariants = true;
|
usesVariants = true;
|
||||||
variantTableLabel = actionInput.getInstance().getTable(backend.getVariantOptionsTableName()).getLabel();
|
variantTableLabel = QContext.getQInstance().getTable(backend.getVariantOptionsTableName()).getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.helpContents = tableMetaData.getHelpContent();
|
this.helpContents = tableMetaData.getHelpContent();
|
||||||
|
@ -27,6 +27,7 @@ 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 java.util.stream.Collectors;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
||||||
@ -76,7 +77,7 @@ public class BulkDeleteLoadStep extends LoadViaDeleteStep implements ProcessSumm
|
|||||||
{
|
{
|
||||||
super.preRun(runBackendStepInput, runBackendStepOutput);
|
super.preRun(runBackendStepInput, runBackendStepOutput);
|
||||||
|
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
if(table != null)
|
if(table != null)
|
||||||
{
|
{
|
||||||
tableLabel = table.getLabel();
|
tableLabel = table.getLabel();
|
||||||
@ -119,7 +120,7 @@ public class BulkDeleteLoadStep extends LoadViaDeleteStep implements ProcessSumm
|
|||||||
////////////////////////////
|
////////////////////////////
|
||||||
super.runOnePage(runBackendStepInput, runBackendStepOutput);
|
super.runOnePage(runBackendStepInput, runBackendStepOutput);
|
||||||
|
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
String primaryKeyFieldName = table.getPrimaryKeyField();
|
String primaryKeyFieldName = table.getPrimaryKeyField();
|
||||||
Map<Serializable, QRecord> outputRecordMap = runBackendStepOutput.getRecords().stream().collect(Collectors.toMap(r -> r.getValue(primaryKeyFieldName), r -> r, (a, b) -> a));
|
Map<Serializable, QRecord> outputRecordMap = runBackendStepOutput.getRecords().stream().collect(Collectors.toMap(r -> r.getValue(primaryKeyFieldName), r -> r, (a, b) -> a));
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.DeleteAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.DeleteAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
||||||
@ -65,7 +66,7 @@ public class BulkDeleteTransformStep extends AbstractTransformStep
|
|||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// capture the table label - for the process summary //
|
// capture the table label - for the process summary //
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
if(table != null)
|
if(table != null)
|
||||||
{
|
{
|
||||||
tableLabel = table.getLabel();
|
tableLabel = table.getLabel();
|
||||||
|
@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.processes.implementations.bulk.edit;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
||||||
@ -99,7 +100,7 @@ public class BulkEditLoadStep extends LoadViaUpdateStep implements ProcessSummar
|
|||||||
{
|
{
|
||||||
super.preRun(runBackendStepInput, runBackendStepOutput);
|
super.preRun(runBackendStepInput, runBackendStepOutput);
|
||||||
|
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
if(table != null)
|
if(table != null)
|
||||||
{
|
{
|
||||||
tableLabel = table.getLabel();
|
tableLabel = table.getLabel();
|
||||||
@ -124,7 +125,7 @@ public class BulkEditLoadStep extends LoadViaUpdateStep implements ProcessSummar
|
|||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// roll up results based on output from update action //
|
// roll up results based on output from update action //
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
for(QRecord record : runBackendStepOutput.getRecords())
|
for(QRecord record : runBackendStepOutput.getRecords())
|
||||||
{
|
{
|
||||||
Serializable recordPrimaryKey = record.getValue(table.getPrimaryKeyField());
|
Serializable recordPrimaryKey = record.getValue(table.getPrimaryKeyField());
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Optional;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QPossibleValueTranslator;
|
import com.kingsrook.qqq.backend.core.actions.values.QPossibleValueTranslator;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
||||||
@ -81,7 +82,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
|
|||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// capture the table label - for the process summary //
|
// capture the table label - for the process summary //
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
if(table != null)
|
if(table != null)
|
||||||
{
|
{
|
||||||
tableLabel = table.getLabel();
|
tableLabel = table.getLabel();
|
||||||
@ -230,7 +231,7 @@ public class BulkEditTransformStep extends AbstractTransformStep
|
|||||||
|
|
||||||
if(field.getPossibleValueSourceName() != null)
|
if(field.getPossibleValueSourceName() != null)
|
||||||
{
|
{
|
||||||
QPossibleValueTranslator qPossibleValueTranslator = new QPossibleValueTranslator(runBackendStepInput.getInstance(), runBackendStepInput.getSession());
|
QPossibleValueTranslator qPossibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
String translatedValue = qPossibleValueTranslator.translatePossibleValue(field, value);
|
String translatedValue = qPossibleValueTranslator.translatePossibleValue(field, value);
|
||||||
if(StringUtils.hasContent(translatedValue))
|
if(StringUtils.hasContent(translatedValue))
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import com.kingsrook.qqq.backend.core.adapters.CsvToQRecordAdapter;
|
import com.kingsrook.qqq.backend.core.adapters.CsvToQRecordAdapter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.QUploadedFile;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.QUploadedFile;
|
||||||
@ -83,7 +84,7 @@ public class BulkInsertExtractStep extends AbstractExtractStep
|
|||||||
.withLimit(getLimit())
|
.withLimit(getLimit())
|
||||||
.withCsv(new String(bytes))
|
.withCsv(new String(bytes))
|
||||||
.withDoCorrectValueTypes(true)
|
.withDoCorrectValueTypes(true)
|
||||||
.withTable(runBackendStepInput.getInstance().getTable(tableName))
|
.withTable(QContext.getQInstance().getTable(tableName))
|
||||||
.withMapping(mapping)
|
.withMapping(mapping)
|
||||||
.withRecordCustomizer((record) ->
|
.withRecordCustomizer((record) ->
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,7 @@ import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizerInterfa
|
|||||||
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers;
|
import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.helpers.UniqueKeyHelper;
|
import com.kingsrook.qqq.backend.core.actions.tables.helpers.UniqueKeyHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface;
|
||||||
@ -104,7 +105,7 @@ public class BulkInsertTransformStep extends AbstractTransformStep
|
|||||||
@Override
|
@Override
|
||||||
public void preRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
public void preRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
{
|
{
|
||||||
this.table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
this.table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// since we're doing a unique key check in this class, we can tell the loadViaInsert step that it (rather, the InsertAction) doesn't need to re-do one. //
|
// since we're doing a unique key check in this class, we can tell the loadViaInsert step that it (rather, the InsertAction) doesn't need to re-do one. //
|
||||||
@ -121,7 +122,7 @@ public class BulkInsertTransformStep extends AbstractTransformStep
|
|||||||
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
{
|
{
|
||||||
int rowsInThisPage = runBackendStepInput.getRecords().size();
|
int rowsInThisPage = runBackendStepInput.getRecords().size();
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getTableName());
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getTableName());
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// set up an insert-input, which will be used as input to the pre-customizer as well as for additional validations //
|
// set up an insert-input, which will be used as input to the pre-customizer as well as for additional validations //
|
||||||
|
@ -28,6 +28,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
import com.kingsrook.qqq.backend.core.adapters.JsonToQFieldMappingAdapter;
|
import com.kingsrook.qqq.backend.core.adapters.JsonToQFieldMappingAdapter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -85,7 +86,7 @@ public class BasicETLTransformFunction implements BackendStep
|
|||||||
throw (new QException("Mapping was not a Key-based mapping type. Was a : " + mapping.getClass().getName()));
|
throw (new QException("Mapping was not a Key-based mapping type. Was a : " + mapping.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(tableName);
|
QTableMetaData table = QContext.getQInstance().getTable(tableName);
|
||||||
List<QRecord> mappedRecords = applyMapping(runBackendStepInput.getRecords(), table, keyBasedFieldMapping);
|
List<QRecord> mappedRecords = applyMapping(runBackendStepInput.getRecords(), table, keyBasedFieldMapping);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QPossibleValueTranslator;
|
import com.kingsrook.qqq.backend.core.actions.values.QPossibleValueTranslator;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||||
@ -85,14 +86,14 @@ public class BaseStreamedETLStep
|
|||||||
protected void updateRecordsWithDisplayValuesAndPossibleValues(RunBackendStepInput input, List<QRecord> list)
|
protected void updateRecordsWithDisplayValuesAndPossibleValues(RunBackendStepInput input, List<QRecord> list)
|
||||||
{
|
{
|
||||||
String destinationTable = input.getValueString(StreamedETLWithFrontendProcess.FIELD_DESTINATION_TABLE);
|
String destinationTable = input.getValueString(StreamedETLWithFrontendProcess.FIELD_DESTINATION_TABLE);
|
||||||
QTableMetaData table = input.getInstance().getTable(destinationTable);
|
QTableMetaData table = QContext.getQInstance().getTable(destinationTable);
|
||||||
|
|
||||||
if(table != null && list != null)
|
if(table != null && list != null)
|
||||||
{
|
{
|
||||||
QValueFormatter qValueFormatter = new QValueFormatter();
|
QValueFormatter qValueFormatter = new QValueFormatter();
|
||||||
qValueFormatter.setDisplayValuesInRecords(table, list);
|
qValueFormatter.setDisplayValuesInRecords(table, list);
|
||||||
|
|
||||||
QPossibleValueTranslator qPossibleValueTranslator = new QPossibleValueTranslator(input.getInstance(), input.getSession());
|
QPossibleValueTranslator qPossibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
qPossibleValueTranslator.translatePossibleValuesInRecords(table, list);
|
qPossibleValueTranslator.translatePossibleValuesInRecords(table, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import com.kingsrook.qqq.backend.core.actions.reporting.DistinctFilteringRecordP
|
|||||||
import com.kingsrook.qqq.backend.core.actions.reporting.RecordPipe;
|
import com.kingsrook.qqq.backend.core.actions.reporting.RecordPipe;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -267,7 +268,7 @@ public class ExtractViaQueryStep extends AbstractExtractStep
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// else, check for recordIds from a frontend launching of a process //
|
// else, check for recordIds from a frontend launching of a process //
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FIELD_SOURCE_TABLE));
|
QTableMetaData table = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FIELD_SOURCE_TABLE));
|
||||||
if(table == null)
|
if(table == null)
|
||||||
{
|
{
|
||||||
throw (new QException("source table name was not set - could not load records by id"));
|
throw (new QException("source table name was not set - could not load records by id"));
|
||||||
@ -319,7 +320,7 @@ public class ExtractViaQueryStep extends AbstractExtractStep
|
|||||||
if(needDistinctPipe)
|
if(needDistinctPipe)
|
||||||
{
|
{
|
||||||
String sourceTableName = runBackendStepInput.getValueString(StreamedETLWithFrontendProcess.FIELD_SOURCE_TABLE);
|
String sourceTableName = runBackendStepInput.getValueString(StreamedETLWithFrontendProcess.FIELD_SOURCE_TABLE);
|
||||||
QTableMetaData sourceTable = runBackendStepInput.getInstance().getTable(sourceTableName);
|
QTableMetaData sourceTable = QContext.getQInstance().getTable(sourceTableName);
|
||||||
return (new DistinctFilteringRecordPipe(new UniqueKey(sourceTable.getPrimaryKeyField()), overrideCapacity));
|
return (new DistinctFilteringRecordPipe(new UniqueKey(sourceTable.getPrimaryKeyField()), overrideCapacity));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -28,6 +28,7 @@ import java.util.Optional;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.QBackendTransaction;
|
import com.kingsrook.qqq.backend.core.actions.QBackendTransaction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||||
@ -86,7 +87,7 @@ public class LoadViaInsertOrUpdateStep extends AbstractLoadStep
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void insertAndUpdateRecords(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
public void insertAndUpdateRecords(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
{
|
{
|
||||||
QTableMetaData tableMetaData = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
|
QTableMetaData tableMetaData = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
|
||||||
|
|
||||||
if(CollectionUtils.nullSafeHasContents(recordsToInsert))
|
if(CollectionUtils.nullSafeHasContents(recordsToInsert))
|
||||||
{
|
{
|
||||||
@ -139,7 +140,7 @@ public class LoadViaInsertOrUpdateStep extends AbstractLoadStep
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
protected void evaluateRecords(RunBackendStepInput runBackendStepInput) throws QException
|
protected void evaluateRecords(RunBackendStepInput runBackendStepInput) throws QException
|
||||||
{
|
{
|
||||||
QTableMetaData tableMetaData = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
|
QTableMetaData tableMetaData = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FIELD_DESTINATION_TABLE));
|
||||||
recordsToInsert = new ArrayList<>();
|
recordsToInsert = new ArrayList<>();
|
||||||
recordsToUpdate = new ArrayList<>();
|
recordsToUpdate = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -162,10 +162,10 @@ public class StreamedETLPreviewStep extends BaseStreamedETLStep implements Backe
|
|||||||
private void countRecords(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput, AbstractExtractStep extractStep) throws QException
|
private void countRecords(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput, AbstractExtractStep extractStep) throws QException
|
||||||
{
|
{
|
||||||
String sourceTableName = runBackendStepInput.getValueString(StreamedETLWithFrontendProcess.FIELD_SOURCE_TABLE);
|
String sourceTableName = runBackendStepInput.getValueString(StreamedETLWithFrontendProcess.FIELD_SOURCE_TABLE);
|
||||||
QTableMetaData sourceTable = runBackendStepInput.getInstance().getTable(sourceTableName);
|
QTableMetaData sourceTable = QContext.getQInstance().getTable(sourceTableName);
|
||||||
if(StringUtils.hasContent(sourceTableName))
|
if(StringUtils.hasContent(sourceTableName))
|
||||||
{
|
{
|
||||||
QBackendMetaData sourceTableBackend = runBackendStepInput.getInstance().getBackendForTable(sourceTableName);
|
QBackendMetaData sourceTableBackend = QContext.getQInstance().getBackendForTable(sourceTableName);
|
||||||
if(sourceTable.isCapabilityEnabled(sourceTableBackend, Capability.TABLE_COUNT))
|
if(sourceTable.isCapabilityEnabled(sourceTableBackend, Capability.TABLE_COUNT))
|
||||||
{
|
{
|
||||||
Integer recordCount = extractStep.doCount(runBackendStepInput);
|
Integer recordCount = extractStep.doCount(runBackendStepInput);
|
||||||
|
@ -31,6 +31,7 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
import com.kingsrook.qqq.backend.core.actions.reporting.GenerateReportAction;
|
import com.kingsrook.qqq.backend.core.actions.reporting.GenerateReportAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||||
@ -58,7 +59,7 @@ public class ExecuteReportStep implements BackendStep
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
String reportName = runBackendStepInput.getValueString("reportName");
|
String reportName = runBackendStepInput.getValueString("reportName");
|
||||||
QReportMetaData report = runBackendStepInput.getInstance().getReport(reportName);
|
QReportMetaData report = QContext.getQInstance().getReport(reportName);
|
||||||
File tmpFile = File.createTempFile(reportName, ".xlsx", new File("/tmp/"));
|
File tmpFile = File.createTempFile(reportName, ".xlsx", new File("/tmp/"));
|
||||||
|
|
||||||
runBackendStepInput.getAsyncJobCallback().updateStatus("Generating Report");
|
runBackendStepInput.getAsyncJobCallback().updateStatus("Generating Report");
|
||||||
|
@ -26,6 +26,7 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -106,7 +107,7 @@ public class PrepareReportForRecordStep extends PrepareReportStep
|
|||||||
}
|
}
|
||||||
|
|
||||||
String reportName = runBackendStepInput.getValueString("reportName");
|
String reportName = runBackendStepInput.getValueString("reportName");
|
||||||
QReportMetaData report = runBackendStepInput.getInstance().getReport(reportName);
|
QReportMetaData report = QContext.getQInstance().getReport(reportName);
|
||||||
// runBackendStepOutput.addValue("downloadFileBaseName", runBackendStepInput.getTable().getLabel() + " " + record.getRecordLabel());
|
// runBackendStepOutput.addValue("downloadFileBaseName", runBackendStepInput.getTable().getLabel() + " " + record.getRecordLabel());
|
||||||
runBackendStepOutput.addValue("downloadFileBaseName", report.getLabel() + " - " + record.getRecordLabel());
|
runBackendStepOutput.addValue("downloadFileBaseName", report.getLabel() + " - " + record.getRecordLabel());
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.processes.implementations.reports;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||||
@ -56,7 +57,7 @@ public class PrepareReportStep implements BackendStep
|
|||||||
throw (new QException("Process value [reportName] was not given."));
|
throw (new QException("Process value [reportName] was not given."));
|
||||||
}
|
}
|
||||||
|
|
||||||
QReportMetaData report = runBackendStepInput.getInstance().getReport(reportName);
|
QReportMetaData report = QContext.getQInstance().getReport(reportName);
|
||||||
if(report == null)
|
if(report == null)
|
||||||
{
|
{
|
||||||
throw (new QException("Process named [" + reportName + "] was not found in this instance."));
|
throw (new QException("Process named [" + reportName + "] was not found in this instance."));
|
||||||
|
@ -145,7 +145,7 @@ public class StoreScriptRevisionProcessStep implements BackendStep
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scriptRevision.setValue("author", input.getSession().getUser().getFullName());
|
scriptRevision.setValue("author", QContext.getQSession().getUser().getFullName());
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -365,10 +365,10 @@ public abstract class AbstractTableSyncTransformStep extends AbstractTransformSt
|
|||||||
{
|
{
|
||||||
if(possibleValueTranslator == null)
|
if(possibleValueTranslator == null)
|
||||||
{
|
{
|
||||||
possibleValueTranslator = new QPossibleValueTranslator(runBackendStepInput.getInstance(), runBackendStepInput.getSession());
|
possibleValueTranslator = new QPossibleValueTranslator(QContext.getQInstance(), QContext.getQSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleValueTranslator.translatePossibleValuesInRecords(runBackendStepInput.getInstance().getTable(destinationTableName), runBackendStepOutput.getRecords());
|
possibleValueTranslator.translatePossibleValuesInRecords(QContext.getQInstance().getTable(destinationTableName), runBackendStepOutput.getRecords());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import java.util.function.Consumer;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -515,7 +516,7 @@ public class GeneralProcessUtils
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public static Integer validateSingleSelectedId(RunBackendStepInput runBackendStepInput, String tableName) throws QException
|
public static Integer validateSingleSelectedId(RunBackendStepInput runBackendStepInput, String tableName) throws QException
|
||||||
{
|
{
|
||||||
String tableLabel = runBackendStepInput.getInstance().getTable(tableName).getLabel();
|
String tableLabel = QContext.getQInstance().getTable(tableName).getLabel();
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// Get the selected recordId and verify we only 1 //
|
// Get the selected recordId and verify we only 1 //
|
||||||
|
@ -174,7 +174,7 @@ class StandardScheduledExecutorTest extends BaseTest
|
|||||||
@Override
|
@Override
|
||||||
public void execute(RecordAutomationInput recordAutomationInput) throws QException
|
public void execute(RecordAutomationInput recordAutomationInput) throws QException
|
||||||
{
|
{
|
||||||
sessionId = recordAutomationInput.getSession().getIdReference();
|
sessionId = QContext.getQSession().getIdReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.api.actions;
|
|||||||
|
|
||||||
|
|
||||||
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.AbstractTableActionInput;
|
import com.kingsrook.qqq.backend.core.model.actions.AbstractTableActionInput;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.QBackendMetaData;
|
||||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||||
@ -45,9 +46,9 @@ public abstract class AbstractAPIAction
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public void preAction(AbstractTableActionInput actionInput)
|
public void preAction(AbstractTableActionInput actionInput)
|
||||||
{
|
{
|
||||||
QBackendMetaData baseBackendMetaData = actionInput.getInstance().getBackendForTable(actionInput.getTableName());
|
QBackendMetaData baseBackendMetaData = QContext.getQInstance().getBackendForTable(actionInput.getTableName());
|
||||||
this.backendMetaData = (APIBackendMetaData) baseBackendMetaData;
|
this.backendMetaData = (APIBackendMetaData) baseBackendMetaData;
|
||||||
this.session = actionInput.getSession();
|
this.session = QContext.getQSession();
|
||||||
|
|
||||||
if(backendMetaData.getActionUtil() != null)
|
if(backendMetaData.getActionUtil() != null)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.module.filesystem.processes.implementations.et
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -68,8 +69,8 @@ public class BasicETLCleanupSourceFilesStep implements BackendStep
|
|||||||
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
{
|
{
|
||||||
String sourceTableName = runBackendStepInput.getValueString(BasicETLProcess.FIELD_SOURCE_TABLE);
|
String sourceTableName = runBackendStepInput.getValueString(BasicETLProcess.FIELD_SOURCE_TABLE);
|
||||||
QTableMetaData table = runBackendStepInput.getInstance().getTable(sourceTableName);
|
QTableMetaData table = QContext.getQInstance().getTable(sourceTableName);
|
||||||
QBackendMetaData backend = runBackendStepInput.getInstance().getBackendForTable(sourceTableName);
|
QBackendMetaData backend = QContext.getQInstance().getBackendForTable(sourceTableName);
|
||||||
QBackendModuleInterface module = new QBackendModuleDispatcher().getQBackendModule(backend);
|
QBackendModuleInterface module = new QBackendModuleDispatcher().getQBackendModule(backend);
|
||||||
|
|
||||||
if(!(module instanceof FilesystemBackendModuleInterface filesystemModule))
|
if(!(module instanceof FilesystemBackendModuleInterface filesystemModule))
|
||||||
@ -93,7 +94,7 @@ public class BasicETLCleanupSourceFilesStep implements BackendStep
|
|||||||
if(VALUE_DELETE.equals(moveOrDelete))
|
if(VALUE_DELETE.equals(moveOrDelete))
|
||||||
{
|
{
|
||||||
LOG.info("Deleting ETL source file: " + sourceFile);
|
LOG.info("Deleting ETL source file: " + sourceFile);
|
||||||
actionBase.deleteFile(runBackendStepInput.getInstance(), table, sourceFile);
|
actionBase.deleteFile(QContext.getQInstance(), table, sourceFile);
|
||||||
}
|
}
|
||||||
else if(VALUE_MOVE.equals(moveOrDelete))
|
else if(VALUE_MOVE.equals(moveOrDelete))
|
||||||
{
|
{
|
||||||
@ -105,7 +106,7 @@ public class BasicETLCleanupSourceFilesStep implements BackendStep
|
|||||||
}
|
}
|
||||||
String filePathWithoutBase = actionBase.stripBackendAndTableBasePathsFromFileName(sourceFile, backend, table);
|
String filePathWithoutBase = actionBase.stripBackendAndTableBasePathsFromFileName(sourceFile, backend, table);
|
||||||
String destinationPath = destinationForMoves + File.separator + filePathWithoutBase;
|
String destinationPath = destinationForMoves + File.separator + filePathWithoutBase;
|
||||||
actionBase.moveFile(runBackendStepInput.getInstance(), table, sourceFile, destinationPath);
|
actionBase.moveFile(QContext.getQInstance(), table, sourceFile, destinationPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -127,8 +127,8 @@ public class FilesystemImporterStep implements BackendStep
|
|||||||
Boolean updateFileIfNameExists = runBackendStepInput.getValueBoolean(FIELD_UPDATE_FILE_IF_NAME_EXISTS);
|
Boolean updateFileIfNameExists = runBackendStepInput.getValueBoolean(FIELD_UPDATE_FILE_IF_NAME_EXISTS);
|
||||||
Boolean archiveFileEnabled = runBackendStepInput.getValueBoolean(FIELD_ARCHIVE_FILE_ENABLED);
|
Boolean archiveFileEnabled = runBackendStepInput.getValueBoolean(FIELD_ARCHIVE_FILE_ENABLED);
|
||||||
|
|
||||||
QTableMetaData sourceTable = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FIELD_SOURCE_TABLE));
|
QTableMetaData sourceTable = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FIELD_SOURCE_TABLE));
|
||||||
QTableMetaData importFileTable = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FIELD_IMPORT_FILE_TABLE));
|
QTableMetaData importFileTable = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FIELD_IMPORT_FILE_TABLE));
|
||||||
|
|
||||||
String missingFieldErrorPrefix = "Process " + runBackendStepInput.getProcessName() + " was misconfigured - missing value in field: ";
|
String missingFieldErrorPrefix = "Process " + runBackendStepInput.getProcessName() + " was misconfigured - missing value in field: ";
|
||||||
Objects.requireNonNull(fileFormat, missingFieldErrorPrefix + FIELD_FILE_FORMAT);
|
Objects.requireNonNull(fileFormat, missingFieldErrorPrefix + FIELD_FILE_FORMAT);
|
||||||
@ -137,7 +137,7 @@ public class FilesystemImporterStep implements BackendStep
|
|||||||
// list files in the backend system //
|
// list files in the backend system //
|
||||||
// todo - can we do this using query action, with this being a "ONE" type table? //
|
// todo - can we do this using query action, with this being a "ONE" type table? //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
QBackendMetaData sourceBackend = runBackendStepInput.getInstance().getBackendForTable(sourceTable.getName());
|
QBackendMetaData sourceBackend = QContext.getQInstance().getBackendForTable(sourceTable.getName());
|
||||||
FilesystemBackendModuleInterface<F> sourceModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(sourceBackend);
|
FilesystemBackendModuleInterface<F> sourceModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(sourceBackend);
|
||||||
AbstractBaseFilesystemAction<F> sourceActionBase = sourceModule.getActionBase();
|
AbstractBaseFilesystemAction<F> sourceActionBase = sourceModule.getActionBase();
|
||||||
sourceActionBase.preAction(sourceBackend);
|
sourceActionBase.preAction(sourceBackend);
|
||||||
@ -340,7 +340,7 @@ public class FilesystemImporterStep implements BackendStep
|
|||||||
QTableMetaData archiveTable;
|
QTableMetaData archiveTable;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
archiveTable = runBackendStepInput.getInstance().getTable(archiveTableName);
|
archiveTable = QContext.getQInstance().getTable(archiveTableName);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@ -349,7 +349,7 @@ public class FilesystemImporterStep implements BackendStep
|
|||||||
|
|
||||||
String archivePath = Objects.requireNonNullElse(runBackendStepInput.getValueString(FIELD_ARCHIVE_PATH), "");
|
String archivePath = Objects.requireNonNullElse(runBackendStepInput.getValueString(FIELD_ARCHIVE_PATH), "");
|
||||||
|
|
||||||
QBackendMetaData archiveBackend = runBackendStepInput.getInstance().getBackendForTable(archiveTable.getName());
|
QBackendMetaData archiveBackend = QContext.getQInstance().getBackendForTable(archiveTable.getName());
|
||||||
FilesystemBackendModuleInterface<?> archiveModule = (FilesystemBackendModuleInterface<?>) new QBackendModuleDispatcher().getQBackendModule(archiveBackend);
|
FilesystemBackendModuleInterface<?> archiveModule = (FilesystemBackendModuleInterface<?>) new QBackendModuleDispatcher().getQBackendModule(archiveBackend);
|
||||||
AbstractBaseFilesystemAction<?> archiveActionBase = archiveModule.getActionBase();
|
AbstractBaseFilesystemAction<?> archiveActionBase = archiveModule.getActionBase();
|
||||||
archiveActionBase.preAction(archiveBackend);
|
archiveActionBase.preAction(archiveBackend);
|
||||||
|
@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||||
@ -74,23 +75,23 @@ public class FilesystemSyncStep implements BackendStep
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private <F> void doRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
private <F> void doRun(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||||
{
|
{
|
||||||
QTableMetaData sourceTable = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_SOURCE_TABLE));
|
QTableMetaData sourceTable = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_SOURCE_TABLE));
|
||||||
QTableMetaData archiveTable = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_ARCHIVE_TABLE));
|
QTableMetaData archiveTable = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_ARCHIVE_TABLE));
|
||||||
QTableMetaData processingTable = runBackendStepInput.getInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_PROCESSING_TABLE));
|
QTableMetaData processingTable = QContext.getQInstance().getTable(runBackendStepInput.getValueString(FilesystemSyncProcess.FIELD_PROCESSING_TABLE));
|
||||||
|
|
||||||
QBackendMetaData sourceBackend = runBackendStepInput.getInstance().getBackendForTable(sourceTable.getName());
|
QBackendMetaData sourceBackend = QContext.getQInstance().getBackendForTable(sourceTable.getName());
|
||||||
FilesystemBackendModuleInterface<F> sourceModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(sourceBackend);
|
FilesystemBackendModuleInterface<F> sourceModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(sourceBackend);
|
||||||
AbstractBaseFilesystemAction<F> sourceActionBase = sourceModule.getActionBase();
|
AbstractBaseFilesystemAction<F> sourceActionBase = sourceModule.getActionBase();
|
||||||
sourceActionBase.preAction(sourceBackend);
|
sourceActionBase.preAction(sourceBackend);
|
||||||
Map<String, F> sourceFiles = getFileNames(sourceActionBase, sourceTable, sourceBackend);
|
Map<String, F> sourceFiles = getFileNames(sourceActionBase, sourceTable, sourceBackend);
|
||||||
|
|
||||||
QBackendMetaData archiveBackend = runBackendStepInput.getInstance().getBackendForTable(archiveTable.getName());
|
QBackendMetaData archiveBackend = QContext.getQInstance().getBackendForTable(archiveTable.getName());
|
||||||
FilesystemBackendModuleInterface<F> archiveModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(archiveBackend);
|
FilesystemBackendModuleInterface<F> archiveModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(archiveBackend);
|
||||||
AbstractBaseFilesystemAction<F> archiveActionBase = archiveModule.getActionBase();
|
AbstractBaseFilesystemAction<F> archiveActionBase = archiveModule.getActionBase();
|
||||||
archiveActionBase.preAction(archiveBackend);
|
archiveActionBase.preAction(archiveBackend);
|
||||||
Set<String> archiveFiles = getFileNames(archiveActionBase, archiveTable, archiveBackend).keySet();
|
Set<String> archiveFiles = getFileNames(archiveActionBase, archiveTable, archiveBackend).keySet();
|
||||||
|
|
||||||
QBackendMetaData processingBackend = runBackendStepInput.getInstance().getBackendForTable(processingTable.getName());
|
QBackendMetaData processingBackend = QContext.getQInstance().getBackendForTable(processingTable.getName());
|
||||||
FilesystemBackendModuleInterface<F> processingModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(processingBackend);
|
FilesystemBackendModuleInterface<F> processingModule = (FilesystemBackendModuleInterface<F>) new QBackendModuleDispatcher().getQBackendModule(processingBackend);
|
||||||
AbstractBaseFilesystemAction<F> processingActionBase = processingModule.getActionBase();
|
AbstractBaseFilesystemAction<F> processingActionBase = processingModule.getActionBase();
|
||||||
processingActionBase.preAction(processingBackend);
|
processingActionBase.preAction(processingBackend);
|
||||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import com.kingsrook.qqq.backend.core.actions.interfaces.AggregateInterface;
|
import com.kingsrook.qqq.backend.core.actions.interfaces.AggregateInterface;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -70,11 +71,11 @@ public class RDBMSAggregateAction extends AbstractRDBMSAction implements Aggrega
|
|||||||
QTableMetaData table = aggregateInput.getTable();
|
QTableMetaData table = aggregateInput.getTable();
|
||||||
|
|
||||||
QQueryFilter filter = clonedOrNewFilter(aggregateInput.getFilter());
|
QQueryFilter filter = clonedOrNewFilter(aggregateInput.getFilter());
|
||||||
JoinsContext joinsContext = new JoinsContext(aggregateInput.getInstance(), table.getName(), aggregateInput.getQueryJoins(), filter);
|
JoinsContext joinsContext = new JoinsContext(QContext.getQInstance(), table.getName(), aggregateInput.getQueryJoins(), filter);
|
||||||
|
|
||||||
List<Serializable> params = new ArrayList<>();
|
List<Serializable> params = new ArrayList<>();
|
||||||
|
|
||||||
String fromClause = makeFromClause(aggregateInput.getInstance(), table.getName(), joinsContext, params);
|
String fromClause = makeFromClause(QContext.getQInstance(), table.getName(), joinsContext, params);
|
||||||
List<String> selectClauses = buildSelectClauses(aggregateInput, joinsContext);
|
List<String> selectClauses = buildSelectClauses(aggregateInput, joinsContext);
|
||||||
|
|
||||||
String sql = "SELECT " + StringUtils.join(", ", selectClauses)
|
String sql = "SELECT " + StringUtils.join(", ", selectClauses)
|
||||||
|
@ -30,6 +30,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import com.kingsrook.qqq.backend.core.actions.interfaces.CountInterface;
|
import com.kingsrook.qqq.backend.core.actions.interfaces.CountInterface;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
@ -63,7 +64,7 @@ public class RDBMSCountAction extends AbstractRDBMSAction implements CountInterf
|
|||||||
QTableMetaData table = countInput.getTable();
|
QTableMetaData table = countInput.getTable();
|
||||||
|
|
||||||
QQueryFilter filter = clonedOrNewFilter(countInput.getFilter());
|
QQueryFilter filter = clonedOrNewFilter(countInput.getFilter());
|
||||||
JoinsContext joinsContext = new JoinsContext(countInput.getInstance(), countInput.getTableName(), countInput.getQueryJoins(), filter);
|
JoinsContext joinsContext = new JoinsContext(QContext.getQInstance(), countInput.getTableName(), countInput.getQueryJoins(), filter);
|
||||||
JoinsContext.FieldAndTableNameOrAlias fieldAndTableNameOrAlias = joinsContext.getFieldAndTableNameOrAlias(table.getPrimaryKeyField());
|
JoinsContext.FieldAndTableNameOrAlias fieldAndTableNameOrAlias = joinsContext.getFieldAndTableNameOrAlias(table.getPrimaryKeyField());
|
||||||
|
|
||||||
boolean requiresDistinct = doesSelectClauseRequireDistinct(table);
|
boolean requiresDistinct = doesSelectClauseRequireDistinct(table);
|
||||||
@ -77,7 +78,7 @@ public class RDBMSCountAction extends AbstractRDBMSAction implements CountInterf
|
|||||||
|
|
||||||
List<Serializable> params = new ArrayList<>();
|
List<Serializable> params = new ArrayList<>();
|
||||||
String sql = clausePrefix + " AS record_count "
|
String sql = clausePrefix + " AS record_count "
|
||||||
+ " FROM " + makeFromClause(countInput.getInstance(), table.getName(), joinsContext, params)
|
+ " FROM " + makeFromClause(QContext.getQInstance(), table.getName(), joinsContext, params)
|
||||||
+ " WHERE " + makeWhereClause(joinsContext, filter, params);
|
+ " WHERE " + makeWhereClause(joinsContext, filter, params);
|
||||||
// todo sql customization - can edit sql and/or param list
|
// todo sql customization - can edit sql and/or param list
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import com.kingsrook.qqq.backend.core.actions.interfaces.DeleteInterface;
|
import com.kingsrook.qqq.backend.core.actions.interfaces.DeleteInterface;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.DeleteAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.DeleteAction;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteInput;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteInput;
|
||||||
@ -273,7 +274,7 @@ public class RDBMSDeleteAction extends AbstractRDBMSAction implements DeleteInte
|
|||||||
QTableMetaData table = deleteInput.getTable();
|
QTableMetaData table = deleteInput.getTable();
|
||||||
|
|
||||||
String tableName = getTableName(table);
|
String tableName = getTableName(table);
|
||||||
JoinsContext joinsContext = new JoinsContext(deleteInput.getInstance(), table.getName(), new ArrayList<>(), deleteInput.getQueryFilter());
|
JoinsContext joinsContext = new JoinsContext(QContext.getQInstance(), table.getName(), new ArrayList<>(), deleteInput.getQueryFilter());
|
||||||
String whereClause = makeWhereClause(joinsContext, filter, params);
|
String whereClause = makeWhereClause(joinsContext, filter, params);
|
||||||
|
|
||||||
// todo sql customization - can edit sql and/or param list?
|
// todo sql customization - can edit sql and/or param list?
|
||||||
|
@ -37,6 +37,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import com.kingsrook.qqq.backend.core.actions.interfaces.QueryInterface;
|
import com.kingsrook.qqq.backend.core.actions.interfaces.QueryInterface;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
import com.kingsrook.qqq.backend.core.actions.tables.helpers.ActionTimeoutHelper;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
import com.kingsrook.qqq.backend.core.instances.QMetaDataVariableInterpreter;
|
import com.kingsrook.qqq.backend.core.instances.QMetaDataVariableInterpreter;
|
||||||
@ -95,10 +96,10 @@ public class RDBMSQueryAction extends AbstractRDBMSAction implements QueryInterf
|
|||||||
StringBuilder sql = new StringBuilder(makeSelectClause(queryInput));
|
StringBuilder sql = new StringBuilder(makeSelectClause(queryInput));
|
||||||
|
|
||||||
QQueryFilter filter = clonedOrNewFilter(queryInput.getFilter());
|
QQueryFilter filter = clonedOrNewFilter(queryInput.getFilter());
|
||||||
JoinsContext joinsContext = new JoinsContext(queryInput.getInstance(), tableName, queryInput.getQueryJoins(), filter);
|
JoinsContext joinsContext = new JoinsContext(QContext.getQInstance(), tableName, queryInput.getQueryJoins(), filter);
|
||||||
|
|
||||||
List<Serializable> params = new ArrayList<>();
|
List<Serializable> params = new ArrayList<>();
|
||||||
sql.append(" FROM ").append(makeFromClause(queryInput.getInstance(), tableName, joinsContext, params));
|
sql.append(" FROM ").append(makeFromClause(QContext.getQInstance(), tableName, joinsContext, params));
|
||||||
sql.append(" WHERE ").append(makeWhereClause(joinsContext, filter, params));
|
sql.append(" WHERE ").append(makeWhereClause(joinsContext, filter, params));
|
||||||
|
|
||||||
if(filter != null && CollectionUtils.nullSafeHasContents(filter.getOrderBys()))
|
if(filter != null && CollectionUtils.nullSafeHasContents(filter.getOrderBys()))
|
||||||
@ -141,7 +142,7 @@ public class RDBMSQueryAction extends AbstractRDBMSAction implements QueryInterf
|
|||||||
{
|
{
|
||||||
if(queryJoin.getSelect())
|
if(queryJoin.getSelect())
|
||||||
{
|
{
|
||||||
QTableMetaData joinTable = queryInput.getInstance().getTable(queryJoin.getJoinTable());
|
QTableMetaData joinTable = QContext.getQInstance().getTable(queryJoin.getJoinTable());
|
||||||
String tableNameOrAlias = queryJoin.getJoinTableOrItsAlias();
|
String tableNameOrAlias = queryJoin.getJoinTableOrItsAlias();
|
||||||
for(QFieldMetaData joinField : joinTable.getFields().values())
|
for(QFieldMetaData joinField : joinTable.getFields().values())
|
||||||
{
|
{
|
||||||
@ -289,7 +290,7 @@ public class RDBMSQueryAction extends AbstractRDBMSAction implements QueryInterf
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private String makeSelectClause(QueryInput queryInput) throws QException
|
private String makeSelectClause(QueryInput queryInput) throws QException
|
||||||
{
|
{
|
||||||
QInstance instance = queryInput.getInstance();
|
QInstance instance = QContext.getQInstance();
|
||||||
String tableName = queryInput.getTableName();
|
String tableName = queryInput.getTableName();
|
||||||
List<QueryJoin> queryJoins = queryInput.getQueryJoins();
|
List<QueryJoin> queryJoins = queryInput.getQueryJoins();
|
||||||
QTableMetaData table = instance.getTable(tableName);
|
QTableMetaData table = instance.getTable(tableName);
|
||||||
|
@ -52,6 +52,7 @@ import com.kingsrook.qqq.backend.core.actions.reporting.GenerateReportAction;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.StorageAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.StorageAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QBadRequestException;
|
import com.kingsrook.qqq.backend.core.exceptions.QBadRequestException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QPermissionDeniedException;
|
import com.kingsrook.qqq.backend.core.exceptions.QPermissionDeniedException;
|
||||||
@ -590,7 +591,7 @@ public class QJavalinProcessHandler
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
private static QQueryFilter buildProcessInitRecordsFilter(Context context, RunProcessInput runProcessInput) throws IOException
|
private static QQueryFilter buildProcessInitRecordsFilter(Context context, RunProcessInput runProcessInput) throws IOException
|
||||||
{
|
{
|
||||||
QInstance instance = runProcessInput.getInstance();
|
QInstance instance = QContext.getQInstance();
|
||||||
QProcessMetaData process = instance.getProcess(runProcessInput.getProcessName());
|
QProcessMetaData process = instance.getProcess(runProcessInput.getProcessName());
|
||||||
QTableMetaData table = instance.getTable(process.getTableName());
|
QTableMetaData table = instance.getTable(process.getTableName());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user