Skip to content

Conversation

@eedwards0
Copy link
Contributor

Jira ticket: ASM-881

Brief description of the change(s)

Mini PR to cover changes to following classes and their usage:


- ExternalRejectEmailData

- ExternalRejectEmailModel

- InternalAvFailedEmailModel

- InternalAvFailedEmailData

Working example

Successful EFS submission in Docker

Test notes

Regression

Checklist

  • Adhered to the coding style guidelines.
    - [ ] Added/updated logging appropriately.
    - [ ] Written tests.
  • Tested the new code in my local environment.
    - [ ] Updated Docker/ECS configs.
    ~~ - [ ] Added all new properties to chs-configs.~~
  • Updated release notes. TODO

Strikethrough (~~like this~~) anything not applicable to your changes.

@eedwards0 eedwards0 requested a review from a team as a code owner December 9, 2025 11:50
@ch-code-analysis
Copy link

CI: Security warnings found!

@chsonarqubeprchecks
Copy link

@eedwards0 eedwards0 requested a review from Copilot December 9, 2025 17:00
Copy link

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 converts several email-related classes from traditional Java classes to Java records, reducing boilerplate code and improving immutability. The changes migrate ExternalRejectEmailData, ExternalRejectEmailModel, InternalAvFailedEmailModel, and InternalAvFailedEmailData to records, along with ExternalAcceptEmailData. All associated tests and usages have been updated to use the new record accessor methods.

Key Changes:

  • Converted 5 email model/data classes from traditional classes to Java records
  • Updated all accessor method calls from getXxx() to the record-style xxx() pattern
  • Added compact constructors to ensure immutability of list fields using List.copyOf()

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ExternalRejectEmailData.java Converted from builder pattern class to record with immutable list handling
ExternalRejectEmailModel.java Converted to record with defensive copying of reject reasons list
InternalAvFailedEmailData.java Converted from builder pattern class to record with immutable list handling
InternalAvFailedEmailModel.java Converted to record with defensive copying of infected files list
ExternalAcceptEmailData.java Converted from builder pattern class to simple record
ExternalRejectEmailMapper.java Updated to use record constructors and accessors, made fields final
InternalAvFailedEmailMapper.java Updated to use record constructors and accessors, made fields final
ExternalAcceptEmailMapper.java Updated to use record constructor instead of builder
EmailServiceImpl.java Updated logging to use record accessors
FesServiceImplTest.java Updated test assertions to use record accessors
ExternalRejectEmailDataTest.java Updated test to construct record directly and use record accessors
ExternalRejectEmailMapperTest.java Updated test to use record constructors and accessors, added final modifiers
InternalAVFailedEmailMapperTest.java Updated test expectations to use record constructors
ExternalAcceptEmailMapperTest.java Updated test to use record constructor, added final modifiers
EmailServiceImplTest.java Updated tests to construct records directly and use record accessors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ch-code-analysis
Copy link

CI: Security warnings found!

Copy link
Contributor

@PhilipGlover PhilipGlover left a comment

Choose a reason for hiding this comment

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

  • have run and successfully reach confirmation
  • code update look good
  • mvn verify green, pipeline and Sonar pass
  • most of the code changes are for emails which I haven't checked, since they depend on a response from CHIPS or AWS. This is only possible in cidev or Staging.
    Ought the Test notes as well as saying Regression required, to draw attention to Accept, Reject emails? I forget how to test the failed AV check.

@eedwards0 eedwards0 merged commit d34d65c into master Dec 10, 2025
2 checks passed
@eedwards0 eedwards0 deleted the feature/sonar-fixes-and-use-java-records-2 branch December 10, 2025 07:50
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.

4 participants