-
Notifications
You must be signed in to change notification settings - Fork 188
/
DashboardEngineController.java
51 lines (41 loc) · 1.89 KB
/
DashboardEngineController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.report.impl.controller.engine;
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.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 java.io.File;
/**
* @author skublik
*/
public class DashboardEngineController extends EngineController {
private static final Trace LOGGER = TraceManager.getTrace(DashboardEngineController.class);
public DashboardEngineController (ReportServiceImpl reportService) {
super(reportService);
}
@Override
public String createReport(ReportType parentReport, ExportController exportController, Task task, OperationResult result) throws Exception {
if (parentReport.getDashboard() != null && parentReport.getDashboard().getDashboardRef() != null) {
DashboardReportEngineConfigurationType dashboardConfig = parentReport.getDashboard();
String reportFilePath = getDestinationFileName(parentReport, exportController);
FileUtils.writeByteArrayToFile(new File(reportFilePath), exportController.processDashboard(dashboardConfig, task, result));
return reportFilePath;
} else {
LOGGER.error("Dashboard or DashboardRef is null");
throw new IllegalArgumentException("Dashboard or DashboardRef is null");
}
}
@Override
public ExportType getDefaultExport() {
return ExportType.HTML;
}
}