IHKExporter.javaplugins/org.projectforge.plugins.ihk/src/main/java/org/projectforge/plugins/ihk/IHKExporter.java Path: plugins/...ihk/src/main/java/.../IHKExporter.java · Lines: 292 · Type: Java Excel export engine 292 lines · 201 code · 39 comments · 52 blank
Excel report generator for IHK apprenticeship weekly reports. The core logic of the plugin — takes a week's timesheet entries, the trainee's configuration (IHKCommentObject), and a Merlin Excel template, and produces a formatted IHK-compliant
.xlsxfile. 292 lines of Java.Architecture
Uses Merlin (Micromata's Excel templating engine, see #221+) — loads an
.xlsxtemplate from the classpath (ClassPathResource("merlin/ihk/ihk.xlsx")), fills in data programmatically, and returns aByteArrayOutputStreamfor download.Key data flows
Period.between(ausbildungsbeginn, now).getYears()→ auto-calculates the training year unlessausbildungsjahris manually setTimesheetDOfor the trainee's entries in the selected week, grouped by dayDecimalFormat("0.00")merlin/ihk/ihk.xlsxteamname), training year, calendar week, date rangeByteArrayOutputStream, returns the byte array for HTTP download with filenameBerichtsheft_KW{week}_{name}.xlsxExcel template structure
The IHK requires a specific report format containing:
The Merlin template (
ihk.xlsx) contains these structural elements; the exporter fills in the dynamic data.Dependencies
de.micromata.merlin.excel.*— Merlin Excel API for template-based Excel generationTimesheetDO— timesheet entries with description, start/stop time, datePFDateTime,PFDay,LocalDate— date/time handling for week boundariesJsonUtils— deserializes IHKCommentObject from address commentAddressDO/ThreadLocalUserContext.getLoggedInUser()— fetches trainee contact for config