Skip to content

DT-3091: Update freemarker template accessors for record model class#2832

Open
rushtong wants to merge 1 commit intodevelopfrom
gr-DT-3091-fix-record-acessors
Open

DT-3091: Update freemarker template accessors for record model class#2832
rushtong wants to merge 1 commit intodevelopfrom
gr-DT-3091-fix-record-acessors

Conversation

@rushtong
Copy link
Contributor

@rushtong rushtong commented Mar 17, 2026

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:

freemarker.core.NonStringOrTemplateOutputException: For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), or "template output" , but this has evaluated to a method+sequence (wrapper: f.e.b.SimpleMethodModel):
==> dataset.identifier  [in template "researcher-dar-approved.ftl" at line 43, column 39]

----
Tip: Maybe using obj.something() instead of obj.something will yield the desired value
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${dataset.identifier}  [in template "researcher-dar-approved.ftl" at line 43, column 37]
----

This PR migrates all usages to method based field accessors for the templates that use a DatasetMailDTO model class.

Screens

Researcher DAR Approved (email type 8) with null data location
Screenshot 2026-03-17 at 3 58 15 PM


Researcher DAR Approved (email type 8) with valid data location
Screenshot 2026-03-17 at 3 58 19 PM


Data Custodian Approval (email type 7)
Screenshot 2026-03-17 at 4 19 49 PM


Researcher PR Approved (email type 24)
Screenshot 2026-03-17 at 4 29 33 PM


DAC RADAR Approval (email type 32)
Screenshot 2026-03-17 at 4 27 04 PM


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

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@sonarqubecloud
Copy link

@rushtong rushtong marked this pull request as ready for review March 17, 2026 20:30
@rushtong rushtong requested a review from a team as a code owner March 17, 2026 20:30
@rushtong rushtong requested review from Copilot, fboulnois, kevinmarete and otchet-broad and removed request for a team March 17, 2026 20:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.identifierdataset.identifier() in affected templates.
  • Update dataset.namedataset.name() in affected templates.
  • Update dataset.dataLocationUrl checks/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants