diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd index 61ba44cf7ee..0c17865fe29 100755 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd @@ -24045,6 +24045,20 @@ + + + +

+ Some export types show tables of objects from widgets. + These tables don't show if this element is true. +

+
+ + 4.2 + DashboardReportEngineConfigurationType.showOnlyWidgetsTable + +
+
diff --git a/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/engine/DashboardEngineController.java b/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/engine/DashboardEngineController.java index be2051573c8..d635f70247a 100644 --- a/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/engine/DashboardEngineController.java +++ b/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/engine/DashboardEngineController.java @@ -6,22 +6,15 @@ */ package com.evolveum.midpoint.report.impl.controller.engine; -import com.evolveum.midpoint.model.api.ModelService; -import com.evolveum.midpoint.prism.PrismContext; -import com.evolveum.midpoint.repo.common.ObjectResolver; -import com.evolveum.midpoint.report.api.ReportService; import com.evolveum.midpoint.report.impl.ReportServiceImpl; import com.evolveum.midpoint.report.impl.controller.export.ExportController; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; -import com.evolveum.midpoint.task.api.TaskManager; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.commons.io.FileUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import java.io.File; diff --git a/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/export/HtmlExportController.java b/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/export/HtmlExportController.java index e271f78841b..2d0df6c1593 100644 --- a/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/export/HtmlExportController.java +++ b/model/report-impl/src/main/java/com/evolveum/midpoint/report/impl/controller/export/HtmlExportController.java @@ -85,54 +85,56 @@ public byte[] processDashboard(DashboardReportEngineConfigurationType dashboardC task.setExpectedTotal((long) dashboard.getWidget().size()); recordProgress(task, i, result, LOGGER); for (DashboardWidgetType widget : dashboard.getWidget()) { - DashboardWidget widgetData = getReportService().getDashboardService().createWidgetData(widget, task, result); - widgetTBody.with(createTBodyRow(widgetData)); if (widget == null) { throw new IllegalArgumentException("Widget in DashboardWidget is null"); } - DashboardWidgetPresentationType presentation = widget.getPresentation(); - if (!DashboardUtils.isDataFieldsOfPresentationNullOrEmpty(presentation)) { - ContainerTag tableBox = null; - DashboardWidgetSourceTypeType sourceType = DashboardUtils.getSourceType(widget); - if (sourceType == null) { - throw new IllegalStateException("No source type specified in " + widget); - } - CollectionRefSpecificationType collectionRefSpecification = getReportService().getDashboardService().getCollectionRefSpecificationType(widget, task, result); - ObjectCollectionType collection = getReportService().getDashboardService().getObjectCollectionType(widget, task, result); - - CompiledObjectCollectionView compiledCollection = new CompiledObjectCollectionView(); - if (collection != null) { - getReportService().getModelInteractionService().applyView(compiledCollection, collection.getDefaultView()); - } else if (collectionRefSpecification.getBaseCollectionRef() != null - && collectionRefSpecification.getBaseCollectionRef().getCollectionRef() != null) { - ObjectCollectionType baseCollection = (ObjectCollectionType) getObjectFromReference(collectionRefSpecification.getBaseCollectionRef().getCollectionRef()).asObjectable(); - getReportService().getModelInteractionService().applyView(compiledCollection, baseCollection.getDefaultView()); - } - - if (widget.getPresentation() != null && widget.getPresentation().getView() != null) { - getReportService().getModelInteractionService().applyView(compiledCollection, widget.getPresentation().getView()); - } - - QName collectionType = resolveTypeQname(collectionRefSpecification, compiledCollection); - GuiObjectListViewType reportView = getReportViewByType(dashboardConfig, collectionType); - if (reportView != null) { - getReportService().getModelInteractionService().applyView(compiledCollection, reportView); - } - - switch (sourceType) { - case OBJECT_COLLECTION: - tableBox = createTableBoxForObjectView(widgetData.getLabel(), collectionRefSpecification, compiledCollection, null, task, result, false); - break; - case AUDIT_SEARCH: - if (collection == null) { - LOGGER.error("CollectionRef is null for report of audit records"); - throw new IllegalArgumentException("CollectionRef is null for report of audit records"); - } - tableBox = createTableBoxForAuditView(widgetData.getLabel(), collectionRefSpecification, compiledCollection, null, task, result, false); - break; - } - if (tableBox != null) { - tableboxesFromWidgets.add(tableBox); + DashboardWidget widgetData = getReportService().getDashboardService().createWidgetData(widget, task, result); + widgetTBody.with(createTBodyRow(widgetData)); + if (!Boolean.TRUE.equals(dashboardConfig.isShowOnlyWidgetsTable())) { + DashboardWidgetPresentationType presentation = widget.getPresentation(); + if (!DashboardUtils.isDataFieldsOfPresentationNullOrEmpty(presentation)) { + ContainerTag tableBox = null; + DashboardWidgetSourceTypeType sourceType = DashboardUtils.getSourceType(widget); + if (sourceType == null) { + throw new IllegalStateException("No source type specified in " + widget); + } + CollectionRefSpecificationType collectionRefSpecification = getReportService().getDashboardService().getCollectionRefSpecificationType(widget, task, result); + ObjectCollectionType collection = getReportService().getDashboardService().getObjectCollectionType(widget, task, result); + + CompiledObjectCollectionView compiledCollection = new CompiledObjectCollectionView(); + if (collection != null) { + getReportService().getModelInteractionService().applyView(compiledCollection, collection.getDefaultView()); + } else if (collectionRefSpecification.getBaseCollectionRef() != null + && collectionRefSpecification.getBaseCollectionRef().getCollectionRef() != null) { + ObjectCollectionType baseCollection = (ObjectCollectionType) getObjectFromReference(collectionRefSpecification.getBaseCollectionRef().getCollectionRef()).asObjectable(); + getReportService().getModelInteractionService().applyView(compiledCollection, baseCollection.getDefaultView()); + } + + if (widget.getPresentation() != null && widget.getPresentation().getView() != null) { + getReportService().getModelInteractionService().applyView(compiledCollection, widget.getPresentation().getView()); + } + + QName collectionType = resolveTypeQname(collectionRefSpecification, compiledCollection); + GuiObjectListViewType reportView = getReportViewByType(dashboardConfig, collectionType); + if (reportView != null) { + getReportService().getModelInteractionService().applyView(compiledCollection, reportView); + } + + switch (sourceType) { + case OBJECT_COLLECTION: + tableBox = createTableBoxForObjectView(widgetData.getLabel(), collectionRefSpecification, compiledCollection, null, task, result, false); + break; + case AUDIT_SEARCH: + if (collection == null) { + LOGGER.error("CollectionRef is null for report of audit records"); + throw new IllegalArgumentException("CollectionRef is null for report of audit records"); + } + tableBox = createTableBoxForAuditView(widgetData.getLabel(), collectionRefSpecification, compiledCollection, null, task, result, false); + break; + } + if (tableBox != null) { + tableboxesFromWidgets.add(tableBox); + } } } i++;