Search in sources :

Example 1 with DashboardWidgetHolder

use of com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder in project midpoint by Evolveum.

the class ClassicDashboardReportExportActivityRun method beforeRun.

@Override
public void beforeRun(OperationResult result) throws ActivityRunException, CommonException {
    RunningTask task = getRunningTask();
    support.beforeExecution(result);
    @NotNull ReportType report = support.getReport();
    support.stateCheck(result);
    List<DashboardWidgetType> widgets = support.getDashboard().getWidget();
    mapOfWidgetsController = new LinkedHashMap<>();
    dataWriter = ReportUtils.createDashboardDataWriter(report, getActivityHandler().reportService, support.getMapOfCompiledViews());
    basicWidgetController = new DashboardWidgetExportController(dataWriter, report, reportService);
    basicWidgetController.initialize();
    basicWidgetController.beforeBucketExecution(1, result);
    for (DashboardWidgetType widget : widgets) {
        if (support.isWidgetTableVisible()) {
            String widgetIdentifier = widget.getIdentifier();
            ContainerableReportDataSource searchSpecificationHolder = new ContainerableReportDataSource(support);
            DashboardExportController<Containerable> controller = new DashboardExportController(searchSpecificationHolder, dataWriter, report, reportService, support.getCompiledCollectionView(widgetIdentifier), widgetIdentifier, support.getReportParameters());
            controller.initialize(task, result);
            controller.beforeBucketExecution(1, result);
            mapOfWidgetsController.put(widgetIdentifier, new DashboardWidgetHolder(searchSpecificationHolder, controller));
        }
    }
}
Also used : NotNull(org.jetbrains.annotations.NotNull) DashboardWidgetHolder(com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder) RunningTask(com.evolveum.midpoint.task.api.RunningTask) Containerable(com.evolveum.midpoint.prism.Containerable)

Example 2 with DashboardWidgetHolder

use of com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder in project midpoint by Evolveum.

the class ClassicDashboardReportExportActivityRun method iterateOverItemsInBucket.

@Override
public void iterateOverItemsInBucket(OperationResult result) throws CommonException {
    // Issue the search to audit or model/repository
    // And use the following handler to handle the results
    List<DashboardWidgetType> widgets = support.getDashboard().getWidget();
    AtomicInteger widgetSequence = new AtomicInteger(1);
    for (DashboardWidgetType widget : widgets) {
        ExportDashboardReportLine<Containerable> widgetLine = new ExportDashboardReportLine<>(widgetSequence.getAndIncrement(), widget);
        ItemProcessingRequest<ExportDashboardReportLine<Containerable>> widgetRequest = new ExportDashboardReportLineProcessingRequest(widgetLine, this);
        coordinator.submit(widgetRequest, result);
        if (support.isWidgetTableVisible()) {
            AtomicInteger sequence = new AtomicInteger(1);
            Handler<Containerable> handler = record -> {
                ExportDashboardReportLine<Containerable> line = new ExportDashboardReportLine<>(sequence.getAndIncrement(), record, widget.getIdentifier());
                ItemProcessingRequest<ExportDashboardReportLine<Containerable>> request = new ExportDashboardReportLineProcessingRequest(line, this);
                coordinator.submit(request, result);
                return true;
            };
            DashboardWidgetHolder holder = mapOfWidgetsController.get(widget.getIdentifier());
            ContainerableReportDataSource searchSpecificationHolder = holder.getSearchSpecificationHolder();
            searchSpecificationHolder.run(handler, result);
        }
    }
}
Also used : ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) ActivityRunException(com.evolveum.midpoint.repo.common.activity.run.ActivityRunException) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) com.evolveum.midpoint.repo.common.activity.run(com.evolveum.midpoint.repo.common.activity.run) RunningTask(com.evolveum.midpoint.task.api.RunningTask) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) com.evolveum.midpoint.report.impl.controller(com.evolveum.midpoint.report.impl.controller) ReportServiceImpl(com.evolveum.midpoint.report.impl.ReportServiceImpl) CommonException(com.evolveum.midpoint.util.exception.CommonException) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) Handler(com.evolveum.midpoint.util.Handler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Containerable(com.evolveum.midpoint.prism.Containerable) DashboardWidgetHolder(com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder) NotNull(org.jetbrains.annotations.NotNull) ReportUtils(com.evolveum.midpoint.report.impl.ReportUtils) DashboardWidgetHolder(com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) Containerable(com.evolveum.midpoint.prism.Containerable)

Aggregations

Containerable (com.evolveum.midpoint.prism.Containerable)2 DashboardWidgetHolder (com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder)2 RunningTask (com.evolveum.midpoint.task.api.RunningTask)2 NotNull (org.jetbrains.annotations.NotNull)2 com.evolveum.midpoint.repo.common.activity.run (com.evolveum.midpoint.repo.common.activity.run)1 ActivityRunException (com.evolveum.midpoint.repo.common.activity.run.ActivityRunException)1 ItemProcessingRequest (com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest)1 ReportServiceImpl (com.evolveum.midpoint.report.impl.ReportServiceImpl)1 ReportUtils (com.evolveum.midpoint.report.impl.ReportUtils)1 com.evolveum.midpoint.report.impl.controller (com.evolveum.midpoint.report.impl.controller)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Handler (com.evolveum.midpoint.util.Handler)1 CommonException (com.evolveum.midpoint.util.exception.CommonException)1 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1