Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a2d3982
Dev/cct 2473 main (#82)
erolkurelihmcts Apr 24, 2026
3d8d014
updating poms for 17.103.168 branch with snapshot versions
Apr 24, 2026
f4823f7
updating poms for 17.103.169-SNAPSHOT development
Apr 24, 2026
1f1e83c
updating poms for branch'dev/release-17.103.168' with non-snapshot ve…
Apr 24, 2026
6c47853
Merge branch 'dev/release-17.103.168' into dev/release
Apr 24, 2026
f1ece3d
updating develop poms to master versions to avoid merge conflicts
Apr 24, 2026
5879d3f
Merge branch 'dev/release' into main
Apr 24, 2026
d0e6705
Updating develop poms back to pre merge state
Apr 24, 2026
3777f27
CCT-2473 Code Merge (#83)
erolkurelihmcts Apr 24, 2026
72f4a59
updating poms for 17.103.169 branch with snapshot versions
Apr 24, 2026
01c5057
updating poms for 17.103.170-SNAPSHOT development
Apr 24, 2026
b2f76bb
updating poms for branch'dev/release-17.103.169' with non-snapshot ve…
Apr 24, 2026
b28436f
Merge branch 'dev/release-17.103.169' into dev/release
Apr 24, 2026
04d668b
updating develop poms to master versions to avoid merge conflicts
Apr 24, 2026
e00b23f
Merge branch 'dev/release' into main
Apr 24, 2026
f9be385
Updating develop poms back to pre merge state
Apr 24, 2026
74a4c71
[DD-42429] - Updated progression and core domain version
habibulrahaman May 5, 2026
cf820fa
Merge pull request #88 from hmcts/dev/DD-42429
habibulrahaman May 5, 2026
80822ba
updating poms for 17.103.170 branch with snapshot versions
May 5, 2026
cd8602e
updating poms for 17.103.171-SNAPSHOT development
May 5, 2026
fb617e1
updating poms for branch'dev/release-17.103.170' with non-snapshot ve…
May 5, 2026
eb368fc
Merge branch 'dev/release-17.103.170' into dev/release
May 5, 2026
41745c3
updating develop poms to master versions to avoid merge conflicts
May 5, 2026
0b4fba2
Merge branch 'dev/release' into main
May 5, 2026
9ca0665
Updating develop poms back to pre merge state
May 5, 2026
7c3f3e1
Dev/rel 3rd line 2612 (#95)
sajanchandran May 15, 2026
f3f43ed
updating poms for 17.103.171 branch with snapshot versions
May 15, 2026
af4075e
updating poms for 17.103.172-SNAPSHOT development
May 15, 2026
12b917b
updating poms for branch'dev/release-17.103.171' with non-snapshot ve…
May 15, 2026
e88c59c
Merge branch 'dev/release-17.103.171' into dev/release
May 15, 2026
c5f463d
updating develop poms to master versions to avoid merge conflicts
May 15, 2026
16fad98
Merge branch 'dev/release' into main
May 15, 2026
a1c6da1
Updating develop poms back to pre merge state
May 15, 2026
4af22fc
Merge remote-tracking branch 'origin/main' into team/cimd3210
May 27, 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
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.gov.moj.cpp.common</groupId>
<artifactId>service-parent-pom</artifactId>
<version>17.103.5</version>
<version>17.103.11</version>
</parent>

<groupId>uk.gov.moj.cpp.sjp</groupId>
Expand Down Expand Up @@ -46,14 +46,14 @@
<referencedata.offences.version>17.0.38</referencedata.offences.version>
<scheduling.version>17.0.11</scheduling.version>
<authorisation.service.version>0.1.49</authorisation.service.version>
<usersgroups.version>17.104.46</usersgroups.version>
<progression.version>17.0.246</progression.version>
<usersgroups.version>17.104.48</usersgroups.version>
<progression.version>17.0.262</progression.version>
<prosecutioncasefile.version>17.0.66</prosecutioncasefile.version>
<access-control-sjp-providers.version>4.1.4-ATCM</access-control-sjp-providers.version>
<cpp.framework.action.mapping.enabled>true</cpp.framework.action.mapping.enabled>
<mvn.site.url>file://${project.build.directory}/site</mvn.site.url>
<file.alfresco.version>2.3.0</file.alfresco.version>
<coredomain.version>17.103.12</coredomain.version>
<coredomain.version>17.103.13</coredomain.version>
<criminal-court-public-model.version>${coredomain.version}</criminal-court-public-model.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<joda-time.version>2.10</joda-time.version>
Expand All @@ -66,7 +66,7 @@
<argLine>-Djava.locale.providers=CLDR</argLine>
<elasticsearch-maven-plugin.version>6.13</elasticsearch-maven-plugin.version>
<elasticsearch.embedded.version>7.16.2</elasticsearch.embedded.version>
<stagingenforcement.version>17.103.76</stagingenforcement.version>
<stagingenforcement.version>17.104.81</stagingenforcement.version>
<unifiedsearch.version>17.0.26</unifiedsearch.version>
<jsonassert.version>1.5.0</jsonassert.version>
<junit4.version>4.13.1</junit4.version>
Expand Down
2 changes: 1 addition & 1 deletion runIntegrationTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DOCKER_CONTAINER_REGISTRY_HOST_NAME=crmdvrepo01

LIQUIBASE_COMMAND=update
#LIQUIBASE_COMMAND=dropAll

#
#fail script on error
set -e

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.moj.cpp.sjp.command.controller;

import static javax.json.Json.createObjectBuilder;
import static uk.gov.justice.services.core.annotation.Component.COMMAND_CONTROLLER;
import static uk.gov.justice.services.messaging.JsonEnvelope.envelopeFrom;
import static uk.gov.justice.services.messaging.JsonEnvelope.metadataFrom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import static java.util.Optional.ofNullable;
import static java.util.UUID.randomUUID;
import static javax.json.Json.createArrayBuilder;
import static javax.json.Json.createObjectBuilder;
import static uk.gov.justice.services.core.annotation.Component.COMMAND_CONTROLLER;
import static uk.gov.justice.services.core.enveloper.Enveloper.envelop;
import static uk.gov.justice.services.messaging.JsonObjects.createObjectBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void acknowledgeDefendantDetailsUpdates(
final ProsecutingAuthorityAccess currentUsersProsecutingAuthorityAccess = prosecutingAuthorityProvider.getCurrentUsersProsecutingAuthorityAccess(command);

final Stream<Object> events = caseAggregate
.acknowledgeDefendantDetailsUpdates(defendantId, clock.now(), currentUsersProsecutingAuthorityAccess.getProsecutingAuthority());
.acknowledgeDefendantDetailsUpdates(defendantId, clock.now(), currentUsersProsecutingAuthorityAccess.getProsecutingAuthority(),
currentUsersProsecutingAuthorityAccess.getAgentProsecutorAuthorityAccess());

eventStream.append(events.map(enveloper.withMetadataFrom(command)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public void addDatesToAvoid(final JsonEnvelope command) throws EventStreamExcept
final JsonObject payload = command.payloadAsJsonObject();
final String datesToAvoid = payload.getString("datesToAvoid");
final ProsecutingAuthorityAccess prosecutingAuthorityAccess = prosecutingAuthorityProvider.getCurrentUsersProsecutingAuthorityAccess(command);
applyToCaseAggregate(command, aggregate -> aggregate.addDatesToAvoid(datesToAvoid, prosecutingAuthorityAccess.getProsecutingAuthority()));
applyToCaseAggregate(command, aggregate -> aggregate.addDatesToAvoid(datesToAvoid, prosecutingAuthorityAccess.getProsecutingAuthority(),
prosecutingAuthorityAccess.getAgentProsecutorAuthorityAccess()));
}

@Handles("sjp.command.expire-dates-to-avoid-timer")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void setOffencesWithdrawalRequestsStatus(final Envelope<SetOffencesWithdr
UUID.fromString(command.metadata().userId().get()),
clock.now(),
offencesWithdrawalRequestsStatus,
prosecutingAuthorityAccess.getProsecutingAuthority()));
prosecutingAuthorityAccess.getProsecutingAuthority(),
prosecutingAuthorityAccess.getAgentProsecutorAuthorityAccess()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
},
"required": [
"name",
"address",
"contactDetails"
"address"
],
"additionalProperties": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public void shouldHandleOffenceWithdrawalRequestCorrectly() throws EventStreamEx
final UUID offenceId_2 = randomUUID();
final ZonedDateTime setAt = clock.now();
final String prosecutionAuthority = "ALL";
final List<String> agentProsecutorAuthorityAccess = List.of("TFL", "TVL");

final SetOffencesWithdrawalRequestsStatus requestsStatus = new SetOffencesWithdrawalRequestsStatus(caseId, requestPayload(offenceId_1, offenceId_2));
final UUID userId = randomUUID();
Expand All @@ -125,6 +126,7 @@ public void shouldHandleOffenceWithdrawalRequestCorrectly() throws EventStreamEx
when(aggregateService.get(eventStream, CaseAggregate.class)).thenReturn(caseAggregate);
when(prosecutingAuthorityProvider.getCurrentUsersProsecutingAuthorityAccess(any())).thenReturn(prosecutingAuthorityAccess);
when(prosecutingAuthorityAccess.getProsecutingAuthority()).thenReturn(prosecutionAuthority);
when(prosecutingAuthorityAccess.getAgentProsecutorAuthorityAccess()).thenReturn(agentProsecutorAuthorityAccess);

final List<uk.gov.moj.cpp.sjp.domain.aggregate.state.WithdrawalRequestsStatus> offenceWithdrawalRequestsStatus =
requestsStatus.getWithdrawalRequestsStatus().stream()
Expand All @@ -134,7 +136,7 @@ public void shouldHandleOffenceWithdrawalRequestCorrectly() throws EventStreamEx
)
.collect(Collectors.toList());

when(caseAggregate.requestForOffenceWithdrawal(eq(requestsStatus.getCaseId()), eq(userId), eq(setAt), eq(offenceWithdrawalRequestsStatus), eq(prosecutionAuthority)))
when(caseAggregate.requestForOffenceWithdrawal(eq(requestsStatus.getCaseId()), eq(userId), eq(setAt), eq(offenceWithdrawalRequestsStatus), eq(prosecutionAuthority), eq(agentProsecutorAuthorityAccess)))
.thenReturn(Stream.of(new OffencesWithdrawalRequestsStatusSet(caseId, setAt, userId, requestPayload(offenceId_1, offenceId_2)),
new OffenceWithdrawalRequested(caseId, offenceId_1, withdrawalRequestReasonId, userId, setAt),
new OffenceWithdrawalRequested(caseId, offenceId_2, withdrawalRequestReasonId, userId, setAt)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ public Stream<Object> updateHearingRequirements(final UUID userId,
return apply(CaseLanguageHandler.INSTANCE.updateHearingRequirements(userId, defendantId, interpreterLanguage, speakWelsh, state, pleaMethod, createdOn));
}

public Stream<Object> addDatesToAvoid(final String datesToAvoid, final String userProsecutingAuthority) {
return applyAndResolveCaseReadiness(() -> CaseCoreHandler.INSTANCE.addDatesToAvoid(datesToAvoid, state, userProsecutingAuthority));
public Stream<Object> addDatesToAvoid(final String datesToAvoid, final String userProsecutingAuthority, final List<String> agentProsecutorAuthorityAccess) {
return applyAndResolveCaseReadiness(() -> CaseCoreHandler.INSTANCE.addDatesToAvoid(datesToAvoid, state, userProsecutingAuthority, agentProsecutorAuthorityAccess));
}

public Stream<Object> expireDefendantResponseTimer() {
Expand Down Expand Up @@ -258,9 +258,10 @@ public Stream<Object> markAsLegalSocChecked(final UUID caseId, final UUID checke
public Stream<Object> acknowledgeDefendantDetailsUpdates(
final UUID defendantId,
final ZonedDateTime acknowledgedAt,
final String userProsecutingAuthority) {
final String userProsecutingAuthority,
final List<String> agentProsecutorAuthorityAccess) {

return apply(CaseDefendantHandler.INSTANCE.acknowledgeDefendantDetailsUpdates(defendantId, acknowledgedAt, state, userProsecutingAuthority));
return apply(CaseDefendantHandler.INSTANCE.acknowledgeDefendantDetailsUpdates(defendantId, acknowledgedAt, state, userProsecutingAuthority, agentProsecutorAuthorityAccess));
}

public Stream<Object> updateDefendantDetails(final UUID userId,
Expand Down Expand Up @@ -368,8 +369,10 @@ public Stream<Object> addCaseNote(final UUID caseId, final Note note, final User
state));
}

public Stream<Object> requestForOffenceWithdrawal(final UUID caseId, final UUID setBy, final ZonedDateTime setAt, final List<WithdrawalRequestsStatus> withdrawalRequestsStatus, final String prosecutionAuthority) {
return applyAndResolveCaseReadiness(() -> OffenceWithdrawalHandler.INSTANCE.requestOffenceWithdrawal(caseId, setBy, setAt, withdrawalRequestsStatus, state, prosecutionAuthority));
public Stream<Object> requestForOffenceWithdrawal(final UUID caseId, final UUID setBy, final ZonedDateTime setAt, final List<WithdrawalRequestsStatus> withdrawalRequestsStatus,
final String prosecutionAuthority, final List<String> agentProsecutorAuthorityAccess) {
return applyAndResolveCaseReadiness(() -> OffenceWithdrawalHandler.INSTANCE.requestOffenceWithdrawal(caseId, setBy, setAt, withdrawalRequestsStatus, state,
prosecutionAuthority, agentProsecutorAuthorityAccess));
}

public Stream<Object> setPleas(final UUID caseId, final SetPleas pleas, final UUID userId, final ZonedDateTime pleadAt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ public Stream<Object> updateCaseListedInCcForReferToCourt(final List<CaseOffence
}

public Stream<Object> addDatesToAvoid(final String datesToAvoid,
final CaseAggregateState state, final String userProsecutingAuthority) {
final CaseAggregateState state, final String userProsecutingAuthority,
final List<String> agentProsecutorAuthorityAccess) {

return createRejectionEvents(
null,
"Add dates to avoid",
null,
state,
userProsecutingAuthority
userProsecutingAuthority,
agentProsecutorAuthorityAccess
).orElse(Stream.of(state.getDatesToAvoid() == null ?
new DatesToAvoidAdded(state.getCaseId(), datesToAvoid) :
new DatesToAvoidUpdated(state.getCaseId(), datesToAvoid)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -66,7 +67,8 @@ public Stream<Object> acknowledgeDefendantDetailsUpdates(
final UUID defendantId,
final ZonedDateTime acknowledgedAt,
final CaseAggregateState state,
final String userProsecutingAuthority) {
final String userProsecutingAuthority,
final List<String> agentProsecutorAuthorityAccess) {

Object event;
if (state.getCaseId() == null) {
Expand All @@ -75,8 +77,19 @@ public Stream<Object> acknowledgeDefendantDetailsUpdates(
} else if (defendantId != null && !state.hasDefendant(defendantId)) {
LOGGER.warn("Defendant not found: {}", defendantId);
event = new DefendantNotFound(defendantId, "Acknowledge defendant details updates");
} else if (!(state.getProsecutingAuthority().toUpperCase().startsWith(userProsecutingAuthority) || "ALL".equalsIgnoreCase(userProsecutingAuthority))) {
event = new ProsecutionAuthorityAccessDenied(userProsecutingAuthority, state.getProsecutingAuthority());
} else if (!(state.getProsecutingAuthority().toUpperCase().startsWith(userProsecutingAuthority) ||
"ALL".equalsIgnoreCase(userProsecutingAuthority) ||
(agentProsecutorAuthorityAccess != null && agentProsecutorAuthorityAccess.stream().anyMatch(s-> s.equalsIgnoreCase(state.getProsecutingAuthority()))))) {

final List<String> prosecutorAuthorityAccess = new ArrayList<>();

if(agentProsecutorAuthorityAccess != null && agentProsecutorAuthorityAccess.size() > 1) {
prosecutorAuthorityAccess.addAll(agentProsecutorAuthorityAccess);
} else {
prosecutorAuthorityAccess.add(userProsecutingAuthority);
}

event = new ProsecutionAuthorityAccessDenied(state.getProsecutingAuthority(), prosecutorAuthorityAccess);
} else {
event = new DefendantDetailsUpdatesAcknowledged(state.getCaseId(), defendantId, acknowledgedAt);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import uk.gov.moj.cpp.sjp.event.DefendantNotFound;
import uk.gov.moj.cpp.sjp.event.OffenceNotFound;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand All @@ -35,7 +36,8 @@ public static Optional<Stream<Object>> createRejectionEvents(final UUID userId,
final String action,
final UUID defendantId,
final CaseAggregateState state,
final String userProsecutingAuthority) {
final String userProsecutingAuthority, // initial
final List<String> agentProsecutorAuthorityAccess) { // new
Object event = null;
if (isNull(state.getCaseId())) {
LOGGER.warn("Case not found: {}", action);
Expand All @@ -52,8 +54,19 @@ public static Optional<Stream<Object>> createRejectionEvents(final UUID userId,
} else if (state.isCaseReferredForCourtHearing()) {
LOGGER.warn("Update rejected because case is referred to court for hearing: {}", action);
event = new CaseUpdateRejected(state.getCaseId(), CaseUpdateRejected.RejectReason.CASE_REFERRED_FOR_COURT_HEARING);
} else if (!(state.getProsecutingAuthority().toUpperCase().startsWith(userProsecutingAuthority) || "ALL".equalsIgnoreCase(userProsecutingAuthority))) {
event = new ProsecutionAuthorityAccessDenied(userProsecutingAuthority, state.getProsecutingAuthority());
} else if (!(state.getProsecutingAuthority().toUpperCase().startsWith(userProsecutingAuthority) ||
"ALL".equalsIgnoreCase(userProsecutingAuthority) ||
(agentProsecutorAuthorityAccess != null && agentProsecutorAuthorityAccess.stream().anyMatch(s-> s.equalsIgnoreCase(state.getProsecutingAuthority()))))) {

final List<String> prosecutorAuthorityAccess = new ArrayList<>();

if(agentProsecutorAuthorityAccess != null && agentProsecutorAuthorityAccess.size() > 1) {
prosecutorAuthorityAccess.addAll(agentProsecutorAuthorityAccess);
} else {
prosecutorAuthorityAccess.add(userProsecutingAuthority);
}

event = new ProsecutionAuthorityAccessDenied(state.getProsecutingAuthority(), prosecutorAuthorityAccess);
}

return Optional.ofNullable(event).map(Stream::of);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ public class OffenceWithdrawalHandler {
private OffenceWithdrawalHandler() {
}

public Stream<Object> requestOffenceWithdrawal(final UUID caseId, final UUID setBy, final ZonedDateTime setAt, final List<WithdrawalRequestsStatus> withdrawalRequestsStatus, final CaseAggregateState state, final String prosecutionAuthority) {
public Stream<Object> requestOffenceWithdrawal(final UUID caseId, final UUID setBy, final ZonedDateTime setAt, final List<WithdrawalRequestsStatus> withdrawalRequestsStatus,
final CaseAggregateState state, final String prosecutionAuthority, final List<String> agentProsecutorAuthorityAccess) {

return HandlerUtils.
createRejectionEvents(null, "Request Offence Withdrawal", null, state, prosecutionAuthority).
createRejectionEvents(null, "Request Offence Withdrawal", null, state, prosecutionAuthority, agentProsecutorAuthorityAccess).
orElse(createWithdrawalEvents(caseId, setBy, setAt, withdrawalRequestsStatus, state));
}

Expand Down
Loading
Loading