Skip to content

HDPI-5493 - Create Document Type list dynamically for England and Wales specific#1850

Open
guygrewal77 wants to merge 9 commits into
masterfrom
HDPI-5493-document-cat-related-changes
Open

HDPI-5493 - Create Document Type list dynamically for England and Wales specific#1850
guygrewal77 wants to merge 9 commits into
masterfrom
HDPI-5493-document-cat-related-changes

Conversation

@guygrewal77
Copy link
Copy Markdown
Contributor

@guygrewal77 guygrewal77 commented May 19, 2026

Jira link

See HDPI-5493

Change description

The Document List will be different for England and Wales and so will be created dynamically in the Upload Additional documents page.

Testing done

XUI testing to ensure the Document Types are in the right order and country specific, and also the documents are placed in the correct folders in Case File View.

Screenshot 2026-05-20 at 09 29 05 Screenshot 2026-05-20 at 09 35 05 Screenshot 2026-05-20 at 10 48 59 Screenshot 2026-05-20 at 09 47 17

Security Vulnerability Assessment

CVE Suppression: Are there any CVEs present in the codebase (either newly introduced or pre-existing) that are being intentionally suppressed or ignored by this commit?

  • Yes
  • No

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

CCD diff summary

👉 Full report: https://github.com/hmcts/pcs-api/actions/runs/26235997915?check_suite_focus=true

CaseField.json

RegularExpressionMaxSearchableMinFieldTypeParameterHintTextLabelIDFieldType
+
+
+
+
+AdditionalDocuments
+Upload a document to the system
+Add document
+additionalDocs
+Collection

AuthorisationCaseField/caseworker-pcs-solicitor.json

UserRoleCaseFieldIDCRUD
+caseworker-pcs-solicitor
+additionalDocs
+CRUD
-caseworker-pcs-solicitor
-additionalDocuments
-CRUD

ComplexTypes/AdditionalDocuments.json

ElementLabelFieldTypeIDListElementCode
+Type of document
+DynamicList
+AdditionalDocuments
+documentTypeList
+Document
+Document
+AdditionalDocuments
+document
+Short description
+TextArea
+AdditionalDocuments
+description

CaseEventToFields/resumePossessionClaim.json

RetainHiddenValueCaseEventFieldLabelCaseEventFieldHintShowSummaryChangeOptionFieldShowConditionPageShowConditionCallBackURLMidEventPageLabelPageIDPageFieldDisplayOrderPageDisplayOrderPageColumnNumberDisplayContextCaseFieldIDCaseEventID
+
+
+
+Y
+
+
+
+Upload additional documents
+uploadAdditionalDocuments
+4
+52
+1
+MANDATORY
+additionalDocs
+resumePossessionClaim
-
-
-
-Y
-
-
-
-Upload additional documents
-uploadAdditionalDocuments
-4
-52
-1
-MANDATORY
-additionalDocuments
-resumePossessionClaim

FixedLists/AdditionalDocumentType.json

ListElementCodeListElementID
+EICR_REPORT
+Electrical Installation Condition Report (EICR)
+AdditionalDocumentType
+ENERGY_PERFORMANCE_CERTIFICATE
+Energy performance certificate
+AdditionalDocumentType
+GAS_SAFETY_CERTIFICATE
+Gas safety certificate
+AdditionalDocumentType
+OCCUPATION_LICENCE
+Occupation contract or licence
+AdditionalDocumentType

@guygrewal77 guygrewal77 marked this pull request as ready for review May 20, 2026 09:51
LegislativeCountry legislativeCountry = caseData.getLegislativeCountry();

additionalDocuments.setDocumentTypeList(createAdditionalDocumentList(legislativeCountry));
caseData.setAdditionalDocs(new ArrayList<>());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we add a test for selecting NO here? The mid-event currently initialises additionalDocs regardless of the answer, so a test would confirm no blank upload row is created when the user does not want to upload documents.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@tvr-hmcts tvr-hmcts self-requested a review May 20, 2026 13:20

public static boolean isEnglandSpecific(AdditionalDocumentType val) {
return val == TENANCY_AGREEMENT;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think a more elegant way to achieve this is for the enum constructor to take a Set of the legislative countries for which it applies. See ClaimantType for an example.

It also makes it easier to build up the dynamic list to show based on the legislative country.

label = "Add document",
hint = "Upload a document to the system"
)
private List<ListValue<AdditionalDocuments>> additionalDocs;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't feel very clean to have another field which has a similar name to the one above. I presume you're only doing it to prevent an issue with the ES index but I think at this stage it would be better to make the change properly and be ready to drop the ES index since we're not in Prod yet.

Also it would be better to re-use the existing AdditionalDocument class, rather than making an AdditionalDocuments class with an 's', even though it still only contains one document 🙂

if (lastDot >= 0 && lastDot < uploadedFilename.length() - 1) {
fileExtension = uploadedFilename.substring(lastDot + 1);
fileName = uploadedFilename.substring(0, lastDot);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can use FilenameUtils.getBaseName and FilenameUtils.getExtension here to save having to implement it yourself.

Copy link
Copy Markdown
Contributor

@tvr-hmcts tvr-hmcts left a comment

Choose a reason for hiding this comment

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

LGTM now. Just a minor and I saw Scotts comment while looking at this which I think is worth the consideration.

private ComponentLauncher caseFileView;

@CCD(searchable = false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor vertical spacing?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants