DT-3091: Update freemarker template accessors for record model class#2832
Open
DT-3091: Update freemarker template accessors for record model class#2832
Conversation
|
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.