DT-3091: Update freemarker template accessors for record model class#2832
DT-3091: Update freemarker template accessors for record model class#2832
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates FreeMarker email templates to use method-style accessors for DatasetMailDTO fields after that model was converted to a Java record, fixing production template processing errors where record component access was being treated as a method reference rather than a string value.
Changes:
- Update
dataset.identifier→dataset.identifier()in affected templates. - Update
dataset.name→dataset.name()in affected templates. - Update
dataset.dataLocationUrlchecks/usage →dataset.dataLocationUrl()in researcher-facing templates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/main/resources/freemarker/researcher-progress-report-approved.ftl |
Switch dataset field reads to record component method calls (incl. dataLocationUrl()). |
src/main/resources/freemarker/researcher-dar-approved.ftl |
Switch dataset field reads to record component method calls (incl. dataLocationUrl()). |
src/main/resources/freemarker/data-custodian-approval.html |
Switch dataset field reads to record component method calls for custodian email. |
src/main/resources/freemarker/dac-radar-approved.html |
Switch dataset field reads to record component method calls for DAC RADAR email. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
fboulnois
left a comment
There was a problem hiding this comment.
Can we add a test for this behavior so we do not see regressions?
I'm unable to reproduce the prod behavior locally or in a unit test. In fact, template processing in unit tests work for both cases. The only freemarker configuration we have is here: https://github.com/broadinstitute/terra-helmfile/blob/b7ffb7e6fd7c3bc0556b640e6cadb49a0628bf1e/charts/consent/templates/_consent.yaml.tpl#L63 and that does not explain why prod would behave differently than a local instance. |



Addresses
https://broadworkbench.atlassian.net/browse/DT-3091
Summary
In #2830, we converted the model class used in several email templates to a record class. In local functional and unit testing, record class field accessors work as expected. In production, we now see a template processing exception on these model class fields:
This PR migrates all usages to method based field accessors for the templates that use a
DatasetMailDTOmodel class.Screens
Researcher DAR Approved (email type 8) with null data location

Researcher DAR Approved (email type 8) with valid data location

Data Custodian Approval (email type 7)

Researcher PR Approved (email type 24)

DAC RADAR Approval (email type 32)

Have you read CONTRIBUTING.md lately? If not, do that first.