#1054: ScriptExecutor.kt

projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ScriptExecutor.kt Core Service / Script Engine, projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ScriptExecutor.kt 376 lines · 274 code · 71 comments · 31 blank
Abstract base class for all script executors (Groovy and Kotlin). Manages script compilation from source with #INCLUDE resolution, auto-import injection, variable binding (daos, appId, taskTree, caches, etc.), and script parameter handling. Builds the effective script by merging user code with auto-generated imports and language-specific bindings. Also houses the factory method createScriptExecutor() that auto-detects Kotlin vs Groovy based on val/var/fun keyword presence and the companion STANDARD_IMPORTS set for all scriptable domain types.

Git History

9c7f57f30 Add OrderbookSnapshotScriptingService for script access to order book snapshots
10d4e0aad Add EmployeeScriptingService for script access to employee data
868d6abb7 2025 -> 2026
0f74c4b76 Scripting supports now ExportFile for returning single files as script result.
4550ccc8a MonthlyEmployeeReport: show weekly net and gross hours. Fix select in AuftragDao.positionen.status Scripting: Add PFCaches as variable. GlobalDefaultExceptionHandling: Exception handling improved.
63081666f Source file headers: 2024-> 2025.
aeff942b5 Script execution improved (logging for end user). DynamicTable.jsx: (refresh implementation fixed, refreshMethod is now supported.)
b6eb06c26 Initial test scripts for new PF instances fixed.
36c9acc50 It was a hard, hard work, but Kotlin scripts are running, yeah!
921638f43 WIP
caea043eb Migration stuff in progress... (all tests of all packages: OK).
d394f410f Migration stuff in progress... (all tests of all packages: OK).
2e9839891 Migration stuff in progress...
4c8365b88 Kotlin scripting refactored (All tests OK)
61f05ce90 Migration stuff in progress...
4c04cfd65 MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
67ce75fe9 Migration stuff in progress...
fba4da3f5 ForecastExport now usable for scripts. AuftragFilter.projectList added, RechnungCache stores now invoice positions for better forecast performance.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
be07a5dd8 ScriptExecutor: doesn't throw Exception on endless recursion include anymore.
12dc9eb8f Scripting: show included scripts in list view.
6fb55191f ScriptingTaskTree -> Kotlin, fun matchesMarker implemented.
47aec0fc2 WIP: sudo scripting and executable scripts by normal users.
456f86d97 WIP: sudo scripting and executable scripts by normal users.
bebba9753 WIP: sudo scripting and executable scripts by normal users.
8cc24f533 ScriptExecutor: RoundUnit imported.
007959e2c WIP: scripting: CurrencyFormatter import fixed.
a10660bc8 WIP: scripting.
52ef31ca5 WIP: scripting
1b5d679ad Example scripts and UIEditor supports now kotlin/groovy
2ba9c104f WIP: scripting: download all backups and effective script.
7059cacd4 WIP: Scripting: support of parameter names including white spaces and non java identifiers.
de0d98425 WIP: scripting: fix for null script values.
2c7de7186 WIP: Scripting.
d37760c3e Scripting refactored.