use of com.evolveum.midpoint.web.security.WebApplicationConfiguration in project midpoint by Evolveum.
the class ProgressPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
PageBase page = getPageBase();
WebApplicationConfiguration config = page.getWebApplicationConfiguration();
ProgressReporter reporter = new ProgressReporter(MidPointApplication.get());
reporter.setRefreshInterval(config.getProgressRefreshInterval());
reporter.setAsynchronousExecution(config.isProgressReportingEnabled());
reporter.setAbortEnabled(config.isAbortEnabled());
reporterModel = new AsyncWebProcessModel<>(reporter);
initLayout();
addRefreshingProgressPanel();
}
use of com.evolveum.midpoint.web.security.WebApplicationConfiguration in project midpoint by Evolveum.
the class PageDebugDownloadBehaviour method initFile.
@Override
protected File initFile() {
PageBase page = getPage();
OperationResult result = new OperationResult(OPERATION_CREATE_DOWNLOAD_FILE);
MidPointApplication application = page.getMidpointApplication();
WebApplicationConfiguration config = application.getWebApplicationConfiguration();
File folder = new File(config.getExportFolder());
if (!folder.exists() || !folder.isDirectory()) {
folder.mkdir();
}
String suffix = isUseZip() ? "zip" : "xml";
String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_m_s"));
String fileName = "ExportedData_" + getType().getSimpleName() + "_" + currentTime + "." + suffix;
File file = new File(folder, fileName);
LOGGER.debug("Creating file '{}'.", file.getAbsolutePath());
try (Writer writer = createWriter(file)) {
LOGGER.debug("Exporting objects.");
dumpHeader(writer);
dumpObjectsToStream(writer, result);
dumpFooter(writer);
LOGGER.debug("Export finished.");
result.recomputeStatus();
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't init download link", ex);
result.recordFatalError(getPage().createStringResource("PageDebugDownloadBehaviour.message.initFile.fatalError").getString(), ex);
}
if (!WebComponentUtil.isSuccessOrHandledError(result)) {
page.showResult(result);
page.getSession().error(page.getString("pageDebugList.message.createFileException"));
LOGGER.debug("Removing file '{}'.", file.getAbsolutePath());
Files.remove(file);
throw new RestartResponseException(PageDebugList.class);
}
return file;
}
use of com.evolveum.midpoint.web.security.WebApplicationConfiguration in project midpoint by Evolveum.
the class ProgressPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
PageBase page = getPageBase();
WebApplicationConfiguration config = page.getWebApplicationConfiguration();
ProgressReporter reporter = new ProgressReporter(MidPointApplication.get());
reporter.setRefreshInterval(config.getProgressRefreshInterval());
reporter.setAsynchronousExecution(config.isProgressReportingEnabled());
reporter.setAbortEnabled(config.isAbortEnabled());
reporterModel = new AsyncWebProcessModel<>(reporter);
initLayout();
hide();
}
Aggregations