use of com.bakdata.conquery.apiv1.query.TableExportQuery in project conquery by bakdata.
the class FullExportForm method createSubQueries.
@Override
public Map<String, List<ManagedQuery>> createSubQueries(DatasetRegistry datasets, User user, Dataset submittedDataset) {
// Forms are sent as an array of standard queries containing AND/OR of CQConcepts, we ignore everything and just convert the CQConcepts into CQUnfiltered for export.
final List<CQUnfilteredTable> unfilteredTables = tables.stream().flatMap(Visitable::stream).filter(CQConcept.class::isInstance).map(CQConcept.class::cast).flatMap(concept -> concept.getTables().stream()).map(table -> new CQUnfilteredTable(table.getConnector(), table.getDateColumn())).collect(Collectors.toList());
final TableExportQuery exportQuery = new TableExportQuery(queryGroup.getQuery());
exportQuery.setDateRange(getDateRange());
exportQuery.setTables(unfilteredTables);
final ManagedQuery managedQuery = new ManagedQuery(exportQuery, user, submittedDataset);
return Map.of(ConqueryConstants.SINGLE_RESULT_TABLE_NAME, List.of(managedQuery));
}
Aggregations