From b31fccab2e01428fe2a5333fcf2fab54ad2a0e7c Mon Sep 17 00:00:00 2001 From: Ertugrul Duran Date: Mon, 13 Jul 2026 18:46:02 +0100 Subject: [PATCH] LPT-2278:adding aditional fields --- .../common/xhibit/ReferenceDataCache.java | 1 + .../common/xhibit/ReferenceDataCacheTest.java | 3 + .../domain/referencedata/CourtMapping.java | 67 ++++++++++--------- .../referencedata/CourtMappingsListTest.java | 2 + ...cedata.query.cp-xhibit-court-mappings.json | 16 +++++ 5 files changed, 59 insertions(+), 30 deletions(-) diff --git a/listing-common/src/main/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCache.java b/listing-common/src/main/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCache.java index 974777ed3..1cb6c4863 100644 --- a/listing-common/src/main/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCache.java +++ b/listing-common/src/main/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCache.java @@ -150,6 +150,7 @@ private List resolveCpXhibitCourtMappingsWithMagsFirst(final UUID .withCrestCourtId(mapping.getCrestCourtId()) .withCrestCourtSiteId(mapping.getCrestCourtSiteId()) .withCrestCourtName(mapping.getCrestCourtName()) + .withWelshCrestCourtName(mapping.getWelshCrestCourtName()) .withCrestCourtShortName(mapping.getCrestCourtShortName()) .withWelshCrestCourtShortName(mapping.getWelshCrestCourtShortName()) .withCrestCourtSiteName(mapping.getCrestCourtSiteName()) diff --git a/listing-common/src/test/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCacheTest.java b/listing-common/src/test/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCacheTest.java index 493beab81..f9a7cde7e 100644 --- a/listing-common/src/test/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCacheTest.java +++ b/listing-common/src/test/java/uk/gov/moj/cpp/listing/common/xhibit/ReferenceDataCacheTest.java @@ -484,6 +484,7 @@ public void shouldCopyAllFieldsFromMagsMappingAndOverrideCourtTypeToMagistratesC final String courtIdVal = "432"; final String courtSiteId = "433"; final String courtName = "BLACKFRIARS CROWN"; + final String welshCourtName = "CORON BLACKFRIARS"; final String courtShortName = "BLF"; final String courtSiteName = "BLACKFRIARS SITE"; final String welshCourtSiteName = "SAFLE BLACKFRIARS"; @@ -496,6 +497,7 @@ public void shouldCopyAllFieldsFromMagsMappingAndOverrideCourtTypeToMagistratesC .withCrestCourtId(courtIdVal) .withCrestCourtSiteId(courtSiteId) .withCrestCourtName(courtName) + .withWelshCrestCourtName(welshCourtName) .withCrestCourtShortName(courtShortName) .withCrestCourtSiteName(courtSiteName) .withWelshCrestCourtSiteName(welshCourtSiteName) @@ -524,6 +526,7 @@ public void shouldCopyAllFieldsFromMagsMappingAndOverrideCourtTypeToMagistratesC assertThat(rebuilt.getCrestCourtId(), is(courtIdVal)); assertThat(rebuilt.getCrestCourtSiteId(), is(courtSiteId)); assertThat(rebuilt.getCrestCourtName(), is(courtName)); + assertThat(rebuilt.getWelshCrestCourtName(), is(welshCourtName)); assertThat(rebuilt.getCrestCourtShortName(), is(courtShortName)); assertThat(rebuilt.getCrestCourtSiteName(), is(courtSiteName)); assertThat(rebuilt.getWelshCrestCourtSiteName(), is(welshCourtSiteName)); diff --git a/listing-domain/listing-domain-common/src/main/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMapping.java b/listing-domain/listing-domain-common/src/main/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMapping.java index 2d8fad79c..32f7a75cf 100644 --- a/listing-domain/listing-domain-common/src/main/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMapping.java +++ b/listing-domain/listing-domain-common/src/main/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMapping.java @@ -29,6 +29,8 @@ public class CourtMapping { private String crestCourtName; + private String welshCrestCourtName; + private String crestCourtShortName; private String welshCrestCourtShortName; @@ -51,6 +53,7 @@ public CourtMapping(@JsonProperty("id") final UUID id, @JsonProperty("validFrom") final LocalDate validFrom, @JsonProperty("validTo") final LocalDate validTo, @JsonProperty("crestCourtName") final String crestCourtName, + @JsonProperty("welshCrestCourtName") final String welshCrestCourtName, @JsonProperty("crestCourtShortName") final String crestCourtShortName, @JsonProperty("welshCrestCourtShortName") final String welshCrestCourtShortName, @JsonProperty("crestCourtFullName") final String crestCourtFullName, @@ -66,6 +69,7 @@ public CourtMapping(@JsonProperty("id") final UUID id, this.validFrom = validFrom; this.validTo = validTo; this.crestCourtName = crestCourtName; + this.welshCrestCourtName = welshCrestCourtName; this.crestCourtShortName = crestCourtShortName; this.welshCrestCourtShortName = welshCrestCourtShortName; this.crestCourtFullName = crestCourtFullName; @@ -74,6 +78,9 @@ public CourtMapping(@JsonProperty("id") final UUID id, this.courtType = courtType; } + private CourtMapping() { + } + public UUID getId() { return id; } @@ -110,6 +117,10 @@ public String getCrestCourtName() { return crestCourtName; } + public String getWelshCrestCourtName() { + return welshCrestCourtName; + } + public String getCrestCourtShortName() { return crestCourtShortName; } @@ -135,94 +146,90 @@ public String getCourtType() { } public static class Builder { - private UUID id; - private String oucode; - private String crestCourtId; - private String crestCourtSiteId; - private String crestCourtSiteName; - private String welshCrestCourtSiteName; - private LocalDate validFrom; - private LocalDate validTo; - private String crestCourtName; - private String crestCourtShortName; - private String welshCrestCourtShortName; - private String crestCourtFullName; - private String welshCrestCourtFullName; - private String crestCourtSiteCode; - private String courtType; + private final CourtMapping instance = new CourtMapping(); public CourtMapping.Builder withId(final UUID id) { - this.id = id; + instance.id = id; return this; } public CourtMapping.Builder withOucode(final String oucode) { - this.oucode = oucode; + instance.oucode = oucode; return this; } public CourtMapping.Builder withCrestCourtId(final String crestCourtId) { - this.crestCourtId = crestCourtId; + instance.crestCourtId = crestCourtId; return this; } public CourtMapping.Builder withCrestCourtSiteId(final String crestCourtSiteId) { - this.crestCourtSiteId = crestCourtSiteId; + instance.crestCourtSiteId = crestCourtSiteId; return this; } public CourtMapping.Builder withCrestCourtName(final String crestCourtName) { - this.crestCourtName = crestCourtName; + instance.crestCourtName = crestCourtName; + return this; + } + + public CourtMapping.Builder withWelshCrestCourtName(final String welshCrestCourtName) { + instance.welshCrestCourtName = welshCrestCourtName; return this; } public CourtMapping.Builder withCrestCourtSiteName(final String crestCourtSiteName) { - this.crestCourtSiteName = crestCourtSiteName; + instance.crestCourtSiteName = crestCourtSiteName; return this; } public CourtMapping.Builder withWelshCrestCourtSiteName(final String welshCrestCourtSiteName) { - this.welshCrestCourtSiteName = welshCrestCourtSiteName; + instance.welshCrestCourtSiteName = welshCrestCourtSiteName; return this; } public CourtMapping.Builder withCrestCourtShortName(final String crestCourtShortName) { - this.crestCourtShortName = crestCourtShortName; + instance.crestCourtShortName = crestCourtShortName; return this; } public CourtMapping.Builder withWelshCrestCourtShortName(final String welshCrestCourtShortName) { - this.welshCrestCourtShortName = welshCrestCourtShortName; + instance.welshCrestCourtShortName = welshCrestCourtShortName; + return this; + } + + public CourtMapping.Builder withCrestCourtFullName(final String crestCourtFullName) { + instance.crestCourtFullName = crestCourtFullName; return this; } public CourtMapping.Builder withWelshCrestCourtFullName(final String welshCrestCourtFullName) { - this.welshCrestCourtFullName = welshCrestCourtFullName; + instance.welshCrestCourtFullName = welshCrestCourtFullName; return this; } public CourtMapping.Builder withValidFrom(final LocalDate validFrom) { - this.validFrom = validFrom; + instance.validFrom = validFrom; return this; } public CourtMapping.Builder withValidTo(final LocalDate validTo) { - this.validTo = validTo; + instance.validTo = validTo; return this; } public CourtMapping.Builder withCrestCourtSiteCode(final String crestCourtSiteCode) { - this.crestCourtSiteCode = crestCourtSiteCode; + instance.crestCourtSiteCode = crestCourtSiteCode; return this; } public CourtMapping.Builder withCourtType(final String courtType) { - this.courtType = courtType; + instance.courtType = courtType; return this; } public CourtMapping build() { - return new CourtMapping(id, oucode, crestCourtId, crestCourtSiteId, crestCourtSiteName, welshCrestCourtSiteName, validFrom, validTo, crestCourtName, crestCourtShortName, welshCrestCourtShortName, crestCourtFullName, welshCrestCourtFullName, crestCourtSiteCode, courtType); + return instance; } } } diff --git a/listing-domain/listing-domain-common/src/test/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMappingsListTest.java b/listing-domain/listing-domain-common/src/test/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMappingsListTest.java index fb0a2f1ac..50fcb66ec 100644 --- a/listing-domain/listing-domain-common/src/test/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMappingsListTest.java +++ b/listing-domain/listing-domain-common/src/test/java/uk/gov/moj/cpp/listing/domain/referencedata/CourtMappingsListTest.java @@ -22,6 +22,7 @@ void shouldDeserializeReferenceDataCourtMappingsPayload() throws Exception { "crestCourtSiteName": "PRESTON", "welshCrestCourtSiteName": "PRESTON WELSH", "crestCourtName": "PRESTON", + "welshCrestCourtName": "PRESTON WELSH NAME", "crestCourtShortName": "PREST", "crestCourtFullName": "PRESTON", "welshCrestCourtFullName": "PRESTON WELSH FULL", @@ -40,5 +41,6 @@ void shouldDeserializeReferenceDataCourtMappingsPayload() throws Exception { assertEquals("CROWN_COURT", courtMappingsList.getCpXhibitCourtMappings().get(0).getCourtType()); assertEquals("PRESTON WELSH", courtMappingsList.getCpXhibitCourtMappings().get(0).getWelshCrestCourtSiteName()); assertEquals("PRESTON WELSH FULL", courtMappingsList.getCpXhibitCourtMappings().get(0).getWelshCrestCourtFullName()); + assertEquals("PRESTON WELSH NAME", courtMappingsList.getCpXhibitCourtMappings().get(0).getWelshCrestCourtName()); } } diff --git a/listing-integration-test/src/test/resources/stub-data/referencedata.query.cp-xhibit-court-mappings.json b/listing-integration-test/src/test/resources/stub-data/referencedata.query.cp-xhibit-court-mappings.json index c08aa92c7..c47219f5d 100644 --- a/listing-integration-test/src/test/resources/stub-data/referencedata.query.cp-xhibit-court-mappings.json +++ b/listing-integration-test/src/test/resources/stub-data/referencedata.query.cp-xhibit-court-mappings.json @@ -95,6 +95,22 @@ "crestCourtFullName": "NEWCASTLE UPON TYNE", "crestCourtSiteCode": "C", "courtType": "CROWN_COURT" + }, + { + "id": "9c6f6b2b-2f1a-3f36-9d3c-6e6a2f2b5c4a", + "oucode": "CDF", + "crestCourtId": "100", + "crestCourtSiteId": "100", + "crestCourtSiteName": "Cardiff Crown Court", + "welshCrestCourtSiteName": "Llys y Goron Caerdydd", + "crestCourtName": "Cardiff", + "welshCrestCourtName": "Caerdydd", + "crestCourtShortName": "Cardiff", + "welshCrestCourtShortName": "Caerdydd", + "crestCourtFullName": "Cardiff Crown Court", + "welshCrestCourtFullName": "Llys y Goron Caerdydd", + "crestCourtSiteCode": "CDF01", + "courtType": "CROWN_COURT" } ] } \ No newline at end of file