Search in sources :

Example 1 with TableExportQuery

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));
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) Setter(lombok.Setter) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery) CQUnfilteredTable(com.bakdata.conquery.apiv1.query.concept.filter.CQUnfilteredTable) ManagedForm(com.bakdata.conquery.models.forms.managed.ManagedForm) Getter(lombok.Getter) ManagedInternalForm(com.bakdata.conquery.models.forms.managed.ManagedInternalForm) NotEmpty(javax.validation.constraints.NotEmpty) Valid(javax.validation.Valid) ManagedExecutionId(com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId) ManagedExecution(com.bakdata.conquery.models.execution.ManagedExecution) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) I18n(com.bakdata.conquery.models.i18n.I18n) QueryDescription(com.bakdata.conquery.apiv1.query.QueryDescription) ConqueryConstants(com.bakdata.conquery.ConqueryConstants) Nullable(javax.annotation.Nullable) Range(com.bakdata.conquery.models.common.Range) CPSType(com.bakdata.conquery.io.cps.CPSType) Visitable(com.bakdata.conquery.models.query.Visitable) Set(java.util.Set) Form(com.bakdata.conquery.apiv1.forms.Form) NotNull(javax.validation.constraints.NotNull) User(com.bakdata.conquery.models.auth.entities.User) Collectors(java.util.stream.Collectors) ExportFormC10n(com.bakdata.conquery.internationalization.ExportFormC10n) Dataset(com.bakdata.conquery.models.datasets.Dataset) Consumer(java.util.function.Consumer) List(java.util.List) TableExportQuery(com.bakdata.conquery.apiv1.query.TableExportQuery) C10N(c10n.C10N) QueryResolveContext(com.bakdata.conquery.models.query.QueryResolveContext) LocalDate(java.time.LocalDate) DatasetRegistry(com.bakdata.conquery.models.worker.DatasetRegistry) CQElement(com.bakdata.conquery.apiv1.query.CQElement) CQConcept(com.bakdata.conquery.apiv1.query.concept.specific.CQConcept) Collections(java.util.Collections) CQUnfilteredTable(com.bakdata.conquery.apiv1.query.concept.filter.CQUnfilteredTable) CQConcept(com.bakdata.conquery.apiv1.query.concept.specific.CQConcept) TableExportQuery(com.bakdata.conquery.apiv1.query.TableExportQuery) ManagedQuery(com.bakdata.conquery.models.query.ManagedQuery)

Aggregations

C10N (c10n.C10N)1 ConqueryConstants (com.bakdata.conquery.ConqueryConstants)1 Form (com.bakdata.conquery.apiv1.forms.Form)1 CQElement (com.bakdata.conquery.apiv1.query.CQElement)1 QueryDescription (com.bakdata.conquery.apiv1.query.QueryDescription)1 TableExportQuery (com.bakdata.conquery.apiv1.query.TableExportQuery)1 CQUnfilteredTable (com.bakdata.conquery.apiv1.query.concept.filter.CQUnfilteredTable)1 CQConcept (com.bakdata.conquery.apiv1.query.concept.specific.CQConcept)1 ExportFormC10n (com.bakdata.conquery.internationalization.ExportFormC10n)1 CPSType (com.bakdata.conquery.io.cps.CPSType)1 User (com.bakdata.conquery.models.auth.entities.User)1 Range (com.bakdata.conquery.models.common.Range)1 Dataset (com.bakdata.conquery.models.datasets.Dataset)1 ManagedExecution (com.bakdata.conquery.models.execution.ManagedExecution)1 ManagedForm (com.bakdata.conquery.models.forms.managed.ManagedForm)1 ManagedInternalForm (com.bakdata.conquery.models.forms.managed.ManagedInternalForm)1 I18n (com.bakdata.conquery.models.i18n.I18n)1 ManagedExecutionId (com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId)1 ManagedQuery (com.bakdata.conquery.models.query.ManagedQuery)1 QueryResolveContext (com.bakdata.conquery.models.query.QueryResolveContext)1