Search in sources :

Example 6 with WebApplicationConfiguration

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();
}
Also used : WebApplicationConfiguration(com.evolveum.midpoint.web.security.WebApplicationConfiguration) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Example 7 with WebApplicationConfiguration

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;
}
Also used : MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) RestartResponseException(org.apache.wicket.RestartResponseException) WebApplicationConfiguration(com.evolveum.midpoint.web.security.WebApplicationConfiguration) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) File(org.apache.wicket.util.file.File) AjaxDownloadBehaviorFromFile(com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RestartResponseException(org.apache.wicket.RestartResponseException) SystemException(com.evolveum.midpoint.util.exception.SystemException)

Example 8 with WebApplicationConfiguration

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();
}
Also used : WebApplicationConfiguration(com.evolveum.midpoint.web.security.WebApplicationConfiguration) PageBase(com.evolveum.midpoint.gui.api.page.PageBase)

Aggregations

WebApplicationConfiguration (com.evolveum.midpoint.web.security.WebApplicationConfiguration)8 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)5 File (org.apache.wicket.util.file.File)5 FileUpload (org.apache.wicket.markup.html.form.upload.FileUpload)4 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)3 FileInputStream (java.io.FileInputStream)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 InputStreamReader (java.io.InputStreamReader)2 ReaderInputStream (org.apache.commons.io.input.ReaderInputStream)2 NotNull (org.jetbrains.annotations.NotNull)2 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 ObjectDeltaOperation (com.evolveum.midpoint.schema.ObjectDeltaOperation)1 Task (com.evolveum.midpoint.task.api.Task)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 AjaxDownloadBehaviorFromFile (com.evolveum.midpoint.web.component.AjaxDownloadBehaviorFromFile)1 FeedbackAlerts (com.evolveum.midpoint.web.component.message.FeedbackAlerts)1 ReportDto (com.evolveum.midpoint.web.page.admin.reports.dto.ReportDto)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 IOException (java.io.IOException)1