CE-881 fixes for data-sources w/o tables

This commit is contained in:
2024-04-02 19:29:54 -05:00
parent 30b07e7f3a
commit 01b7b3fe63

View File

@ -78,6 +78,7 @@ import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwith
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunInput; import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunInput;
import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunOutput; import com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend.BackendStepPostRunOutput;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils; import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.ObjectUtils;
import com.kingsrook.qqq.backend.core.utils.Pair; import com.kingsrook.qqq.backend.core.utils.Pair;
import com.kingsrook.qqq.backend.core.utils.StringUtils; import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.aggregates.AggregatesInterface; import com.kingsrook.qqq.backend.core.utils.aggregates.AggregatesInterface;
@ -302,10 +303,9 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
if(StringUtils.hasContent(dataSource.getSourceTable())) if(StringUtils.hasContent(dataSource.getSourceTable()))
{ {
joinsContext = new JoinsContext(exportInput.getInstance(), dataSource.getSourceTable(), dataSource.getQueryJoins(), dataSource.getQueryFilter()); joinsContext = new JoinsContext(exportInput.getInstance(), dataSource.getSourceTable(), dataSource.getQueryJoins(), dataSource.getQueryFilter());
}
countDataSourceRecords(reportInput, dataSource, reportFormat); countDataSourceRecords(reportInput, dataSource, reportFormat);
} }
}
List<QFieldMetaData> fields = new ArrayList<>(); List<QFieldMetaData> fields = new ArrayList<>();
for(QReportField column : CollectionUtils.nonNullList(reportView.getColumns())) for(QReportField column : CollectionUtils.nonNullList(reportView.getColumns()))
@ -320,7 +320,7 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
JoinsContext.FieldAndTableNameOrAlias fieldAndTableNameOrAlias = joinsContext == null ? null : joinsContext.getFieldAndTableNameOrAlias(effectiveFieldName); JoinsContext.FieldAndTableNameOrAlias fieldAndTableNameOrAlias = joinsContext == null ? null : joinsContext.getFieldAndTableNameOrAlias(effectiveFieldName);
if(fieldAndTableNameOrAlias == null || fieldAndTableNameOrAlias.field() == null) if(fieldAndTableNameOrAlias == null || fieldAndTableNameOrAlias.field() == null)
{ {
throw new QReportingException("Could not find field named [" + effectiveFieldName + "] in dataSource [" + dataSource.getName() + "]"); throw new QReportingException("Could not find field named [" + effectiveFieldName + "] in dataSource [" + (dataSource == null ? null : dataSource.getName()) + "]");
} }
QFieldMetaData field = fieldAndTableNameOrAlias.field().clone(); QFieldMetaData field = fieldAndTableNameOrAlias.field().clone();
@ -398,7 +398,7 @@ public class GenerateReportAction extends AbstractQActionFunction<ReportInput, R
RunBackendStepInput finalTransformStepInput = transformStepInput; RunBackendStepInput finalTransformStepInput = transformStepInput;
RunBackendStepOutput finalTransformStepOutput = transformStepOutput; RunBackendStepOutput finalTransformStepOutput = transformStepOutput;
String tableLabel = QContext.getQInstance().getTable(dataSource.getSourceTable()).getLabel(); String tableLabel = ObjectUtils.tryElse(() -> QContext.getQInstance().getTable(dataSource.getSourceTable()).getLabel(), Objects.requireNonNullElse(dataSource.getSourceTable(), ""));
AtomicInteger consumedCount = new AtomicInteger(0); AtomicInteger consumedCount = new AtomicInteger(0);
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////