Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
af835a6
CHD-2551 - merge team/CCT-2353 into main (#350)
aykutdanisman Jun 3, 2026
4ea7d80
updating poms for 17.0.264-SNAPSHOT development
Jun 3, 2026
9d82c6d
version bump of to fix failed build (#354)
jayenhc Jun 4, 2026
bcc8b55
updating poms for 17.0.266-SNAPSHOT development
Jun 4, 2026
b2adffe
Disable flaky IT test (#356)
shettyshrikanth Jun 4, 2026
f0bce26
updating poms for 17.0.266 branch with snapshot versions
Jun 4, 2026
11f2243
updating poms for 17.0.267-SNAPSHOT development
Jun 4, 2026
ebb1fe5
updating poms for branch'dev/release-17.0.266' with non-snapshot vers…
Jun 4, 2026
6850d8e
Merge branch 'dev/release-17.0.266' into dev/release
Jun 4, 2026
cbcac8b
updating develop poms to master versions to avoid merge conflicts
Jun 4, 2026
2392568
Merge branch 'dev/release' into main
Jun 4, 2026
2572d6b
Updating develop poms back to pre merge state
Jun 4, 2026
8501a8d
merge team/CHD-2593 to main (set offences null for breach application…
aykutdanisman Jun 16, 2026
50d049f
updating poms for 17.0.268-SNAPSHOT development
Jun 16, 2026
1130074
update refdata version to fix build (#384)
jayenhc Jun 17, 2026
818346f
updating poms for 17.0.269-SNAPSHOT development
Jun 17, 2026
b2638af
updated pom file to fix build (#387)
jayenhc Jun 17, 2026
2609ecf
updating poms for 17.0.269 branch with snapshot versions
Jun 17, 2026
4ee947d
updating poms for 17.0.270-SNAPSHOT development
Jun 17, 2026
c0eed42
updating poms for branch'dev/release-17.0.269' with non-snapshot vers…
Jun 17, 2026
7d0bf86
Merge branch 'dev/release-17.0.269' into dev/release
Jun 17, 2026
1b126b4
updating develop poms to master versions to avoid merge conflicts
Jun 17, 2026
37aa264
Merge branch 'dev/release' into main
Jun 17, 2026
3a9356a
Updating develop poms back to pre merge state
Jun 17, 2026
8c08675
DD-38231, SNI-9142 (#446)
AnumulaBhagyaLakshmi Jul 2, 2026
8412e13
updating poms for 17.0.271-SNAPSHOT development
Jul 2, 2026
58262f0
updating poms for 17.0.272-SNAPSHOT development
Jul 2, 2026
e5a14ce
updating poms for 17.0.273-SNAPSHOT development
Jul 2, 2026
6840571
updating poms for 17.0.273 branch with snapshot versions
Jul 2, 2026
b9e870a
updating poms for 17.0.274-SNAPSHOT development
Jul 2, 2026
74b527d
updating poms for branch'dev/release-17.0.273' with non-snapshot vers…
Jul 2, 2026
61d5968
Merge branch 'dev/release-17.0.273' into dev/release
Jul 2, 2026
c51b675
updating develop poms to master versions to avoid merge conflicts
Jul 2, 2026
bfe04fb
Merge branch 'dev/release' into main
Jul 2, 2026
b9013eb
Updating develop poms back to pre merge state
Jul 2, 2026
3f1018f
updating poms for 17.0.275-SNAPSHOT development
Jul 2, 2026
566c762
updating poms for 17.0.275 branch with snapshot versions
Jul 3, 2026
23e7856
updating poms for 17.0.276-SNAPSHOT development
Jul 3, 2026
571285a
updating poms for branch'dev/release-17.0.275' with non-snapshot vers…
Jul 3, 2026
3aced28
Merge branch 'dev/release-17.0.275' into dev/release
Jul 3, 2026
830b6ac
updating develop poms to master versions to avoid merge conflicts
Jul 3, 2026
cbb417e
Merge branch 'dev/release' into main
Jul 3, 2026
0a55362
Updating develop poms back to pre merge state
Jul 3, 2026
b29eebb
Merge branch 'main' into dev/CADB34-Rebase
balanagarian Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
<material.version>17.0.75</material.version>
<json-transformer.version>1.0.6</json-transformer.version>
<access.control.version>6.4.1</access.control.version>
<referencedata.version>17.104.136</referencedata.version>
<referencedata.version>17.103.133</referencedata.version>
<listing.version>17.103.162</listing.version>
<hearing.version>17.104.173</hearing.version>
<usersgroups.version>17.104.48</usersgroups.version>
<defence.version>17.0.85</defence.version>
<defence.version>17.104.101</defence.version>
<referencedata.offence.version>17.103.42</referencedata.offence.version>
<coredomain.version>17.103.13</coredomain.version>
<directionsmanagement.version>8.0.30</directionsmanagement.version>
<elasticsearch-maven-plugin.version>6.13</elasticsearch-maven-plugin.version>
<results.version>17.103.105</results.version>
<results.version>17.104.110</results.version>
<notification.notify.version>17.104.44</notification.notify.version>
<unifiedsearch.version>17.0.26</unifiedsearch.version>
<systemdocgenerator.version>17.0.64</systemdocgenerator.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import static java.util.UUID.randomUUID;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.collections.CollectionUtils.isEmpty;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static uk.gov.justice.core.courts.ContactNumber.contactNumber;
Expand Down Expand Up @@ -74,7 +73,6 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import uk.gov.justice.services.eventsourcing.source.core.EventStream;
import uk.gov.justice.services.eventsourcing.source.core.exception.EventStreamException;
import uk.gov.justice.services.messaging.Envelope;
import uk.gov.moj.cpp.progression.aggregate.ApplicationAggregate;
import uk.gov.moj.cpp.progression.aggregate.CaseAggregate;

import java.util.List;
Expand Down Expand Up @@ -77,13 +78,18 @@ private boolean isDefendantsFinancialData(final CourtDocument courtDocument) {

private void updateEventStream(final UUID prosecutionCaseId, final UUID defendantId, final UUID applicationId,
final List<Material> materials,
final Envelope<CreateCourtDocument> createCourtDocumentEnvelope)
throws EventStreamException {

final EventStream eventStream = eventSource.getStreamById(prosecutionCaseId);
final CaseAggregate caseAggregate = aggregateService.get(eventStream, CaseAggregate.class);
final Stream<Object> events = caseAggregate.addFinancialMeansData(prosecutionCaseId, defendantId, applicationId, materials.get(0));
eventStream.append(events.map(Enveloper.toEnvelopeWithMetadataFrom(createCourtDocumentEnvelope)));
final Envelope<CreateCourtDocument> createCourtDocumentEnvelope) throws EventStreamException {
if (prosecutionCaseId != null) {
final EventStream eventStream = eventSource.getStreamById(prosecutionCaseId);
final CaseAggregate caseAggregate = aggregateService.get(eventStream, CaseAggregate.class);
final Stream<Object> events = caseAggregate.addFinancialMeansData(prosecutionCaseId, defendantId, applicationId, materials.get(0));
eventStream.append(events.map(Enveloper.toEnvelopeWithMetadataFrom(createCourtDocumentEnvelope)));
} else if (prosecutionCaseId == null && applicationId != null) {
final EventStream eventStream = eventSource.getStreamById(applicationId);
final ApplicationAggregate applicationAggregate = aggregateService.get(eventStream, ApplicationAggregate.class);
final Stream<Object> events = applicationAggregate.addFinancialMeansData(prosecutionCaseId, defendantId, applicationId, materials.get(0));
eventStream.append(events.map(Enveloper.toEnvelopeWithMetadataFrom(createCourtDocumentEnvelope)));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3152,4 +3152,48 @@ public static Offence buildOffence(final UUID offenceId, final LocalDate convict
.withConvictionDate(convictionDate)
.build();
}

@Test
public void shouldUpdateOffenceWordingForActiveCaseWhenNoCourtOrder() throws EventStreamException {
final InitiateCourtApplicationProceedings initiateCourtApplicationProceedings =
buildInitiateCourtApplicationProceedings(randomUUID(), false, true, false, true, LinkType.LINKED, "ACTIVE");

final Metadata metadata = Envelope
.metadataBuilder()
.withName("progression.command.initiate-court-proceedings-for-application")
.withId(randomUUID())
.build();
final Envelope<InitiateCourtApplicationProceedings> envelope = envelopeFrom(metadata, initiateCourtApplicationProceedings);

final ApplicationAggregate applicationAggregate = new ApplicationAggregate();
when(eventSource.getStreamById(any())).thenReturn(eventStream);
when(aggregateService.get(eventStream, ApplicationAggregate.class)).thenReturn(applicationAggregate);
applicationAggregate.apply(new CourtApplicationProceedingsInitiated.Builder()
.withCourtHearing(new CourtHearingRequest.Builder().build())
.withBoxHearing(new BoxHearingRequest.Builder().build())
.build());

courtApplicationHandler.initiateCourtApplicationProceedings(envelope);

final Stream<JsonEnvelope> envelopeStream = verifyAppendAndGetArgumentFrom(eventStream);

final String expectedWording = "Resentenced Original code : " + ORG_OFFENCE_CODE + ", Original details: " + ORG_OFFENCE_WORDING;
final String expectedWordingWelsh = "Resentenced Original code : " + ORG_OFFENCE_CODE + ", Original details: " + ORG_OFFENCE_WORDING_WELSH;
final UUID activeOffenceId = initiateCourtApplicationProceedings.getCourtApplication().getCourtApplicationCases().get(0).getOffences().get(0).getId();
final UUID activeProsecutionCaseId = initiateCourtApplicationProceedings.getCourtApplication().getCourtApplicationCases().get(0).getProsecutionCaseId();

assertThat(envelopeStream, streamContaining(
jsonEnvelope(
metadata()
.withName("progression.event.court-application-proceedings-initiated"),
payload().isJson(allOf(
withJsonPath("$.courtApplication.courtApplicationCases[0].prosecutionCaseId", is(activeProsecutionCaseId.toString())),
withJsonPath("$.courtApplication.courtApplicationCases[0].offences[0].id", is(activeOffenceId.toString())),
withJsonPath("$.courtApplication.courtApplicationCases[0].offences[0].offenceCode", is(RESENTENCING_ACTIVATION_CODE)),
withJsonPath("$.courtApplication.courtApplicationCases[0].offences[0].wording", is(expectedWording)),
withJsonPath("$.courtApplication.courtApplicationCases[0].offences[0].wordingWelsh", is(expectedWordingWelsh))
))
)
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import uk.gov.justice.services.messaging.Envelope;
import uk.gov.justice.services.messaging.Metadata;
import uk.gov.justice.services.test.utils.core.enveloper.EnveloperFactory;
import uk.gov.moj.cpp.progression.aggregate.ApplicationAggregate;
import uk.gov.moj.cpp.progression.aggregate.CaseAggregate;

import java.util.ArrayList;
Expand Down Expand Up @@ -122,7 +123,45 @@ public void shouldProcessCommand_ApplicationDocument() throws Exception {
.withContainsFinancialMeans(true)
.withMaterials(materials)
.withDocumentCategory(DocumentCategory.documentCategory()
.withApplicationDocument(ApplicationDocument.applicationDocument().withApplicationId(randomUUID()).build())
.withApplicationDocument(ApplicationDocument.applicationDocument().withProsecutionCaseId(randomUUID()).withApplicationId(randomUUID()).build())
.build()
).build();

final CreateCourtDocument createCourtDocument = CreateCourtDocument.createCourtDocument()
.withCourtDocument(courtDocument)
.build();

final Metadata metadata = Envelope
.metadataBuilder()
.withName("progression.command.update-financial-means-data")
.withId(randomUUID())
.build();

final Envelope<CreateCourtDocument> envelope = envelopeFrom(metadata, createCourtDocument);

final CaseAggregate caseAggregate = new CaseAggregate();
when(eventSource.getStreamById(any())).thenReturn(eventStream);
when(aggregateService.get(eventStream, CaseAggregate.class)).thenReturn(caseAggregate);

updateFinancialMeansDataHandler.handle(envelope);

verifyAppendAndGetArgumentFrom(eventStream);
}

@Test
public void shouldProcessCommand_ApplicationDocumentOnlyCaseId() throws Exception {
List<UUID> defendantlist = new ArrayList<>();
defendantlist.add(DEFENDANT_ID);

List<Material> materials = new ArrayList<>();
Material material = Material.material().withId(MATERIAL_ID).withName("MC100").build();
materials.add(material);

final CourtDocument courtDocument = CourtDocument.courtDocument()
.withContainsFinancialMeans(true)
.withMaterials(materials)
.withDocumentCategory(DocumentCategory.documentCategory()
.withApplicationDocument(ApplicationDocument.applicationDocument().withProsecutionCaseId(randomUUID()).build())
.build()
).build();

Expand All @@ -146,4 +185,44 @@ public void shouldProcessCommand_ApplicationDocument() throws Exception {

verifyAppendAndGetArgumentFrom(eventStream);
}


@Test
public void shouldProcessCommand_ApplicationDocumentWithOnlyApplicationIdPresent() throws Exception {
List<UUID> defendantlist = new ArrayList<>();
defendantlist.add(DEFENDANT_ID);

List<Material> materials = new ArrayList<>();
Material material = Material.material().withId(MATERIAL_ID).withName("MC100").build();
materials.add(material);

final CourtDocument courtDocument = CourtDocument.courtDocument()
.withContainsFinancialMeans(true)
.withMaterials(materials)
.withDocumentCategory(DocumentCategory.documentCategory()
.withApplicationDocument(ApplicationDocument.applicationDocument().withApplicationId(randomUUID()).build())
.build()
).build();

final CreateCourtDocument createCourtDocument = CreateCourtDocument.createCourtDocument()
.withCourtDocument(courtDocument)
.build();

final Metadata metadata = Envelope
.metadataBuilder()
.withName("progression.command.update-financial-means-data")
.withId(randomUUID())
.build();

final Envelope<CreateCourtDocument> envelope = envelopeFrom(metadata, createCourtDocument);

final ApplicationAggregate applicationAggregate = new ApplicationAggregate();

when(eventSource.getStreamById(any())).thenReturn(eventStream);
when(aggregateService.get(eventStream, ApplicationAggregate.class)).thenReturn(applicationAggregate);

updateFinancialMeansDataHandler.handle(envelope);

verifyAppendAndGetArgumentFrom(eventStream);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
import uk.gov.justice.core.courts.SlotsBookedForApplication;
import uk.gov.justice.core.courts.SummonsApprovedOutcome;
import uk.gov.justice.core.courts.SummonsRejectedOutcome;
import uk.gov.justice.core.courts.FinancialDataAdded;
import uk.gov.justice.core.courts.Material;
import uk.gov.justice.domain.aggregate.Aggregate;
import uk.gov.justice.progression.courts.HearingDeletedForCourtApplication;
import uk.gov.moj.cpp.progression.application.ApplicationCaseDefendantOrganisation;
Expand Down Expand Up @@ -154,7 +156,7 @@
public class ApplicationAggregate implements Aggregate {

private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationAggregate.class);
private static final long serialVersionUID = 1331113876243908502L;
private static final long serialVersionUID = 1331113876243908503L;
private static final String APPEARANCE_TO_MAKE_STATUTORY_DECLARATION_CODE = "MC80527";
private static final String APPEARANCE_TO_MAKE_STATUTORY_DECLARATION_CODE_SJP = "MC80528";
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
Expand All @@ -168,6 +170,7 @@ public class ApplicationAggregate implements Aggregate {
private final Map<UUID, LaaReference> offenceLaaReference = new HashMap<>();
private LaaReference laaReference;//cloned by child applications. This has to be overridden each time LaaReference updated for application or any offence.
private final Map<UUID, Boolean> applicationOrganisationAsscociatedByRepOrder = new HashMap<>();
private final Map<UUID, List<UUID>> applicationFinancialDocs = new HashMap<>();

@Override
public Object apply(final Object event) {
Expand Down Expand Up @@ -251,6 +254,7 @@ public Object apply(final Object event) {
.build();
}
}),
when(FinancialDataAdded.class).apply(this::populateFinancialData),
otherwiseDoNothing());
}

Expand Down Expand Up @@ -1556,4 +1560,22 @@ private void setLaaReference(final LaaReference laaReference) {
this.laaReference = laaReference;
}

public Stream<Object> addFinancialMeansData(final UUID prosecutionCaseId, final UUID defendantId, final UUID applicationId, final Material material) {
final List<UUID> materialIds = new ArrayList<>();
materialIds.add(material.getId());
return apply(Stream.of(FinancialDataAdded.financialDataAdded()
.withCaseId(prosecutionCaseId)
.withApplicationId(applicationId)
.withDefendantId(defendantId)
.withMaterialIds(materialIds)
.build())
);
}

private void populateFinancialData(final FinancialDataAdded financialDataAdded) {
if (financialDataAdded.getApplicationId() != null) {
this.applicationFinancialDocs.put(financialDataAdded.getApplicationId(), financialDataAdded.getMaterialIds());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
import uk.gov.justice.core.courts.SendNotificationForAutoApplicationInitiated;
import uk.gov.justice.core.courts.SlotsBookedForApplication;
import uk.gov.justice.core.courts.SummonsRejectedOutcome;
import uk.gov.justice.core.courts.FinancialDataAdded;
import uk.gov.justice.core.courts.Material;
import uk.gov.justice.core.courts.CourtDocument;
import uk.gov.justice.core.courts.DocumentCategory;
import uk.gov.justice.core.courts.DefendantDocument;
import uk.gov.justice.core.courts.ApplicationDocument;
import uk.gov.justice.progression.courts.HearingDeletedForCourtApplication;
import uk.gov.justice.progression.courts.SendStatdecAppointmentLetter;
import uk.gov.justice.services.common.converter.JsonObjectToObjectConverter;
Expand Down Expand Up @@ -1979,4 +1985,41 @@ void shouldUpdateApplicationLaaReferenceWhenCourtApplicationExistsAndAnyInputCha
assertThat(hearingApplicationLaaReferenceUpdateReceived.getApplicationId(), is(applicationId));

}

@Test
public void shouldReturnFinancialDataAddedEventWhenApplicationUploadsMC100Form() {

final CourtDocument courtDocument = getCourtDocumentWithApplicationDocumentCategory();
final List<Object> eventStream = aggregate.addFinancialMeansData(courtDocument.getDocumentCategory().getApplicationDocument().getProsecutionCaseId(),
null, courtDocument.getDocumentCategory().getApplicationDocument().getApplicationId(), courtDocument.getMaterials().get(0)).collect(toList());

assertThat(eventStream.size(), is(1));
final Object object = eventStream.get(0);
assertThat(object.getClass(), is(CoreMatchers.<Class<?>>equalTo(FinancialDataAdded.class)));
}

private CourtDocument getCourtDocumentWithApplicationDocumentCategory() {
UUID caseId = UUID.fromString("5002d600-af66-11e8-b568-0800200c9a77");
UUID applicationId = UUID.fromString("5002d600-af66-11e8-b568-0800200c9a88");
UUID materialId = UUID.fromString("5002d600-af66-11e8-b568-0800200c9a99");

List<UUID> defendantlist = new ArrayList<>();
defendantlist.add(applicationId);
List<Material> materials = new ArrayList<>();
Material material = Material.material().withId(materialId).withName("MC100").build();
materials.add(material);


final CourtDocument courtDocument = CourtDocument.courtDocument()
.withContainsFinancialMeans(true)
.withMaterials(materials)
.withDocumentCategory(DocumentCategory.documentCategory()
.withApplicationDocument(ApplicationDocument.applicationDocument().withApplicationId(applicationId).withProsecutionCaseId(caseId).build())
.withDefendantDocument(DefendantDocument.defendantDocument().withDefendants(defendantlist).withProsecutionCaseId(caseId).build())
.build()
).build();

return courtDocument;
}

}
Loading
Loading