#1045: ExportZipArchive.kt

projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ExportZipArchive.kt Script Export (ZIP Archive), projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ExportZipArchive.kt 176 lines · 123 code · 37 comments · 16 blank
Builder for scripts to construct multi-file ZIP archives as execution output. Supports adding Excel workbooks (both legacy ExportWorkbook and newer ExcelWorkbook), JFreeChart images, strings, and raw byte arrays. Optional AES-256 encryption of the entire archive.

Architecture

File Aggregation

Multiple add() overloads accept various export types. Files are collected in a MutableCollection<ExportZipFile>. The write() method streams entries to a ZipOutputStream.

Encryption

If encryptionPassword is set, the archive is first written as an unencrypted ZIP in memory, then encrypted via ZipUtils.encryptZipFile() with configurable mode (default AES-256). The encryption is applied to the entire ZIP, not per-file.

Structure Control

flatStructure flag controls whether files are added to the ZIP root or wrapped in a subdirectory named after the archive. The default creates a filename/ directory entry.

Excel Integration

Supports both legacy ExportWorkbook and newer ExcelWorkbook (Merlin library). For ExcelWorkbook, evaluates all formulas before serialization.

Git History

868d6abb7 2025 -> 2026
332409633 ExportZipArchive supports now flatStructure.
69441cecd ZipMode and ZipUtils moved to common.
543df2d9b Zip encryption is now supported by ExportZipArchive in scripts.
98f600442 WIP Forecast
63081666f Source file headers: 2024-> 2025.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
2ba9c104f WIP: scripting: download all backups and effective script.

#1045: ExportZipArchive.kt

Script Export (ZIP Archive), projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ExportZipArchive.kt
Builder for scripts to construct multi-file ZIP archives as execution output. Supports adding Excel workbooks (both legacy ExportWorkbook and newer ExcelWorkbook), JFreeChart images, strings, and raw byte arrays. Optional AES-256 encryption of the entire archive.

Architecture

File Aggregation

Multiple add() overloads accept various export types. Files are collected in a MutableCollection<ExportZipFile>. The write() method streams entries to a ZipOutputStream.

Encryption

If encryptionPassword is set, the archive is first written as an unencrypted ZIP in memory, then encrypted via ZipUtils.encryptZipFile() with configurable mode (default AES-256). The encryption is applied to the entire ZIP, not per-file.

Structure Control

flatStructure flag controls whether files are added to the ZIP root or wrapped in a subdirectory named after the archive. The default creates a filename/ directory entry.

Excel Integration

Supports both legacy ExportWorkbook and newer ExcelWorkbook (Merlin library). For ExcelWorkbook, evaluates all formulas before serialization.

Git History

868d6abb7 2025 -> 2026
332409633 ExportZipArchive supports now flatStructure.
69441cecd ZipMode and ZipUtils moved to common.
543df2d9b Zip encryption is now supported by ExportZipArchive in scripts.
98f600442 WIP Forecast
63081666f Source file headers: 2024-> 2025.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
2ba9c104f WIP: scripting: download all backups and effective script.