From 3f11cce87506984866ca14fe2a4c2918aa1303fd Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 10:33:30 +0000 Subject: [PATCH 01/17] NFDIV-4448: Add configuration for NFD case deletion --- ccd-definitions/AuthorisationComplexType.json | 5 +- .../event/CitizenUpdateApplication.java | 37 +++++++++++ .../service/task/SetStateAfterSubmission.java | 18 ++++++ .../divorce/divorcecase/model/CaseData.java | 9 +++ .../divorce/divorcecase/model/UserRole.java | 2 + .../model/access/TtlProfileAccess.java | 27 ++++++++ .../systemupdate/event/SystemUpdateTTL.java | 63 +++++++++++++++++++ 7 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java create mode 100644 src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java diff --git a/ccd-definitions/AuthorisationComplexType.json b/ccd-definitions/AuthorisationComplexType.json index 8b7f4e1b454..e92d7e8e0fe 100644 --- a/ccd-definitions/AuthorisationComplexType.json +++ b/ccd-definitions/AuthorisationComplexType.json @@ -26,5 +26,8 @@ {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationID", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationName", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PrepopulateToUsersOrganisation", "UserRole": "caseworker-approver", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"} + {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} ] diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index 9f560b8371c..fa1c526af5f 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -1,12 +1,23 @@ package uk.gov.hmcts.divorce.citizen.event; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import uk.gov.hmcts.ccd.sdk.api.CCDConfig; +import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; +import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.RequestForInformationOfflineResponseDraft; +import uk.gov.hmcts.divorce.divorcecase.model.RequestForInformationResponse; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; +import uk.gov.hmcts.divorce.idam.IdamService; +import uk.gov.hmcts.divorce.idam.User; +import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; +import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; +import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.YES; import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingApplicant1Response; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingClarification; @@ -21,12 +32,19 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.RequestedInformationSubmitted; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CREATOR; import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; +import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; @Component +@RequiredArgsConstructor +@Slf4j public class CitizenUpdateApplication implements CCDConfig { public static final String CITIZEN_UPDATE = "citizen-update-application"; + private final CcdUpdateService ccdUpdateService; + private final IdamService idamService; + private final AuthTokenGenerator authTokenGenerator; + @Override public void configure(final ConfigBuilder configBuilder) { @@ -40,4 +58,23 @@ public void configure(final ConfigBuilder configBuild .description("Patch a divorce or dissolution") .grant(CREATE_READ_UPDATE, CREATOR); } + + public AboutToStartOrSubmitResponse aboutToSubmit(CaseDetails details, + CaseDetails beforeDetails) { + + CaseData caseData = details.getData(); + + //Set TTL for newly created cases from today's date to 6 months in future + if (caseData.getTimeToLive() == null && details.getState() == Draft) { + final User user = idamService.retrieveSystemUpdateUserDetails(); + final String serviceAuthorization = authTokenGenerator.generate(); + + ccdUpdateService.submitEvent(details.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); + } + + return AboutToStartOrSubmitResponse.builder() + .data(details.getData()) + .state(details.getState()) + .build(); + } } diff --git a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java index e152d9d4174..876c046b949 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.divorce.common.service.task; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import uk.gov.hmcts.ccd.sdk.api.CaseDetails; @@ -7,19 +8,30 @@ import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.task.CaseTask; +import uk.gov.hmcts.divorce.idam.IdamService; +import uk.gov.hmcts.divorce.idam.User; +import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; +import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; import static java.util.Objects.nonNull; import static org.springframework.util.CollectionUtils.isEmpty; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingDocuments; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingHWFDecision; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; +import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; +import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; @Component +@RequiredArgsConstructor @Slf4j public class SetStateAfterSubmission implements CaseTask { + private final CcdUpdateService ccdUpdateService; + private final IdamService idamService; + private final AuthTokenGenerator authTokenGenerator; + @Override public CaseDetails apply(final CaseDetails caseDetails) { @@ -38,14 +50,20 @@ public CaseDetails apply(final CaseDetails cas boolean applicantNeedsHelpWithFees = (isSoleApplication && isHWFApplicant1) || (!isSoleApplication && isHWFApplicant1 && isHWFApplicant2); + final User user = idamService.retrieveSystemUpdateUserDetails(); + final String serviceAuthorization = authTokenGenerator.generate(); + if (applicantNeedsHelpWithFees) { caseDetails.setState(AwaitingHWFDecision); + ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } else if (applicantIsAwaitingDocuments) { caseDetails.setState(AwaitingDocuments); + ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } else if (!application.hasBeenPaidFor()) { caseDetails.setState(AwaitingPayment); } else { caseDetails.setState(Submitted); + ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } log.info("State set to {}, CaseID {}", caseDetails.getState(), caseDetails.getId()); diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java index df1fb3b9374..255bf5d7157 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java @@ -19,6 +19,7 @@ import uk.gov.hmcts.ccd.sdk.type.ListValue; import uk.gov.hmcts.ccd.sdk.type.OrderSummary; import uk.gov.hmcts.ccd.sdk.type.ScannedDocument; +import uk.gov.hmcts.ccd.sdk.type.TTL; import uk.gov.hmcts.ccd.sdk.type.YesOrNo; import uk.gov.hmcts.divorce.caseworker.model.CaseNote; import uk.gov.hmcts.divorce.divorcecase.model.access.AcaSystemUserAccess; @@ -31,6 +32,7 @@ import uk.gov.hmcts.divorce.divorcecase.model.access.DefaultAccess; import uk.gov.hmcts.divorce.divorcecase.model.access.SolicitorAndSystemUpdateAccess; import uk.gov.hmcts.divorce.divorcecase.model.access.SystemUpdateAndSuperUserAccess; +import uk.gov.hmcts.divorce.divorcecase.model.access.TtlProfileAccess; import uk.gov.hmcts.divorce.document.model.DivorceDocument; import uk.gov.hmcts.divorce.document.model.DocumentType; import uk.gov.hmcts.divorce.noticeofchange.model.ChangeOfRepresentative; @@ -328,6 +330,13 @@ public class CaseData { @Builder.Default private SentNotifications sentNotifications = new SentNotifications(); + @CCD( + label = "Resolved time to live", + typeOverride = Collection, + access = {TtlProfileAccess.class} + ) + private TTL timeToLive; + @JsonUnwrapped @Builder.Default private RequestForInformationList requestForInformationList = new RequestForInformationList(); diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java index 3826939ed74..dc86da73e53 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java @@ -17,6 +17,8 @@ public enum UserRole implements HasRole { JUDGE("caseworker-divorce-judge", "CRU"), NOC_APPROVER("caseworker-approver", "CRU"), RPA_ROBOT("caseworker-divorce-rparobot", "CRU"), + TTL_PROFILE("TTL_profile", "CRU"), + CFT_TTL_MANAGER("idam:cft-ttl-manager", "CRU"), SOLICITOR("caseworker-divorce-solicitor", "CRU"), APPLICANT_1_SOLICITOR("[APPONESOLICITOR]", "CRU"), diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java new file mode 100644 index 00000000000..deeeb96b622 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java @@ -0,0 +1,27 @@ +package uk.gov.hmcts.divorce.divorcecase.model.access; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.SetMultimap; +import uk.gov.hmcts.ccd.sdk.api.HasAccessControl; +import uk.gov.hmcts.ccd.sdk.api.HasRole; +import uk.gov.hmcts.ccd.sdk.api.Permission; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CASE_WORKER; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CITIZEN; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CREATOR; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.JUDGE; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.LEGAL_ADVISOR; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SOLICITOR; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SUPER_USER; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SYSTEMUPDATE; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; + +public class TtlProfileAccess implements HasAccessControl { + @Override + public SetMultimap getGrants() { + + SetMultimap grants = HashMultimap.create(); + grants.putAll(TTL_PROFILE, Permissions.CREATE_READ_UPDATE); + + return grants; + } +} diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java new file mode 100644 index 00000000000..b31d0f98372 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java @@ -0,0 +1,63 @@ +package uk.gov.hmcts.divorce.systemupdate.event; + +import java.time.LocalDate; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import uk.gov.hmcts.ccd.sdk.api.CCDConfig; +import uk.gov.hmcts.ccd.sdk.api.CaseDetails; +import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; +import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; +import uk.gov.hmcts.ccd.sdk.type.TTL; +import uk.gov.hmcts.ccd.sdk.type.YesOrNo; +import uk.gov.hmcts.divorce.common.ccd.PageBuilder; +import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.divorcecase.model.UserRole; +import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; +import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; +import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CFT_TTL_MANAGER; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SYSTEMUPDATE; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; +import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; + +@Component +@Slf4j +public class SystemUpdateTTL implements CCDConfig { + + public static final String SYSTEM_UPDATE_TTL = "system-update-TTL"; + private static final LocalDate CURRENT_DATE_PLUS_SIX_MONTH = LocalDate.now().plusMonths(6); + + @Override + public void configure(final ConfigBuilder configBuilder) { + + new PageBuilder(configBuilder + .event(SYSTEM_UPDATE_TTL) + .forStates(Draft, AwaitingPayment) + .name("Resolve time to live") + .showCondition(NEVER_SHOW) + .aboutToStartCallback(this::aboutToStart) + .description("Resolve time to live") + .grant(CREATE_READ_UPDATE, TTL_PROFILE)); + + configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); + } + + public AboutToStartOrSubmitResponse aboutToStart(final CaseDetails details) { + + log.info("{} about to start callback invoked for Case Id: {}", SYSTEM_UPDATE_TTL, details.getId()); + final CaseData caseData = details.getData(); + + if (caseData.getTimeToLive() == null && details.getState() == Draft) { + caseData.setTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) + .suspended(YesOrNo.NO) + .build()); + } else { + caseData.setTimeToLive(null); + } + + return AboutToStartOrSubmitResponse.builder() + .data(caseData) + .build(); + } +} From 29d0852e04f4e73f5bd7bf56d75df0b4521b209f Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 13:07:38 +0000 Subject: [PATCH 02/17] NFDIV-4448: Add unit tests --- .../event/CitizenUpdateApplication.java | 3 - .../service/task/SetStateAfterSubmission.java | 1 - .../model/access/TtlProfileAccess.java | 9 +-- .../systemupdate/event/SystemUpdateTTL.java | 5 +- .../event/CitizenUpdateApplicationTest.java | 61 ++++++++++++++ .../task/SetStateAfterSubmissionTest.java | 36 +++++++++ .../event/SystemUpdateTTLTest.java | 79 +++++++++++++++++++ 7 files changed, 180 insertions(+), 14 deletions(-) create mode 100644 src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index fa1c526af5f..cf2fff8ed1d 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -8,8 +8,6 @@ import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; -import uk.gov.hmcts.divorce.divorcecase.model.RequestForInformationOfflineResponseDraft; -import uk.gov.hmcts.divorce.divorcecase.model.RequestForInformationResponse; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; import uk.gov.hmcts.divorce.idam.IdamService; @@ -17,7 +15,6 @@ import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; -import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.YES; import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingApplicant1Response; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingClarification; diff --git a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java index 876c046b949..2552f664340 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java @@ -18,7 +18,6 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingDocuments; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingHWFDecision; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; -import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java index deeeb96b622..0ef4466b8be 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/TtlProfileAccess.java @@ -5,14 +5,7 @@ import uk.gov.hmcts.ccd.sdk.api.HasAccessControl; import uk.gov.hmcts.ccd.sdk.api.HasRole; import uk.gov.hmcts.ccd.sdk.api.Permission; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CASE_WORKER; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CITIZEN; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CREATOR; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.JUDGE; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.LEGAL_ADVISOR; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SOLICITOR; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SUPER_USER; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SYSTEMUPDATE; + import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; public class TtlProfileAccess implements HasAccessControl { diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java index b31d0f98372..254831c64e4 100644 --- a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java +++ b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.divorce.systemupdate.event; -import java.time.LocalDate; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import uk.gov.hmcts.ccd.sdk.api.CCDConfig; @@ -13,11 +12,13 @@ import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; + +import java.time.LocalDate; + import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CFT_TTL_MANAGER; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.SYSTEMUPDATE; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; diff --git a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java index f6077957a36..15e27afc3df 100644 --- a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java @@ -3,21 +3,47 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl; +import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.api.Event; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; +import uk.gov.hmcts.divorce.idam.IdamService; +import uk.gov.hmcts.divorce.idam.User; +import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; +import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; +import uk.gov.hmcts.reform.idam.client.models.UserInfo; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; import static uk.gov.hmcts.divorce.citizen.event.CitizenUpdateApplication.CITIZEN_UPDATE; +import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; +import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; +import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; +import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_UPDATE_AUTH_TOKEN; +import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_USER_USER_ID; +import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_CASE_ID; +import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_SERVICE_AUTH_TOKEN; @ExtendWith(MockitoExtension.class) class CitizenUpdateApplicationTest { + @Mock + private IdamService idamService; + + @Mock + private AuthTokenGenerator authTokenGenerator; + + @Mock + private CcdUpdateService ccdUpdateService; + @InjectMocks private CitizenUpdateApplication citizenUpdateApplication; @@ -31,4 +57,39 @@ void shouldAddConfigurationToConfigBuilder() { .extracting(Event::getId) .contains(CITIZEN_UPDATE); } + + @Test + void shouldCallSystemUpdateTTLEventForDraftStateAndTTLNotSetAboutToSubmitCallback() { + + var userDetails = UserInfo.builder().uid(SYSTEM_USER_USER_ID).build(); + var user = new User(SYSTEM_UPDATE_AUTH_TOKEN, userDetails); + when(idamService.retrieveSystemUpdateUserDetails()).thenReturn(user); + when(authTokenGenerator.generate()).thenReturn(TEST_SERVICE_AUTH_TOKEN); + + CaseDetails beforeDetails = getCaseDetails(Draft); + + citizenUpdateApplication.aboutToSubmit(beforeDetails, beforeDetails); + + verify(ccdUpdateService).submitEvent(beforeDetails.getId(), SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); + } + + @Test + void shouldNotCallSystemUpdateTTLEventForDraftStateAndTTLNotSetAboutToSubmitCallback() { + + CaseDetails beforeDetails = getCaseDetails(Submitted); + + citizenUpdateApplication.aboutToSubmit(beforeDetails, beforeDetails); + + verifyNoInteractions(ccdUpdateService); + } + + private CaseDetails getCaseDetails(State state) { + return CaseDetails.builder() + .id(TEST_CASE_ID) + .state(state) + .data(CaseData.builder() + + .build()) + .build(); + } } diff --git a/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java b/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java index 083bc4bc971..c231b732ede 100644 --- a/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java @@ -1,8 +1,10 @@ package uk.gov.hmcts.divorce.common.service.task; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.type.ListValue; @@ -13,11 +15,19 @@ import uk.gov.hmcts.divorce.divorcecase.model.Payment; import uk.gov.hmcts.divorce.divorcecase.model.ServiceMethod; import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.idam.IdamService; +import uk.gov.hmcts.divorce.idam.User; +import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; +import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; +import uk.gov.hmcts.reform.idam.client.models.UserInfo; import java.util.Set; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.NO; import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.YES; import static uk.gov.hmcts.divorce.divorcecase.model.ApplicationType.JOINT_APPLICATION; @@ -31,15 +41,38 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; import static uk.gov.hmcts.divorce.document.model.DocumentType.MARRIAGE_CERTIFICATE; +import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; +import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_UPDATE_AUTH_TOKEN; +import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_USER_USER_ID; import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_CASE_ID; +import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_SERVICE_AUTH_TOKEN; import static uk.gov.hmcts.divorce.testutil.TestDataHelper.caseData; @ExtendWith(MockitoExtension.class) class SetStateAfterSubmissionTest { + @Mock + private IdamService idamService; + + @Mock + private AuthTokenGenerator authTokenGenerator; + + @Mock + private CcdUpdateService ccdUpdateService; + + private User user; + @InjectMocks private SetStateAfterSubmission setStateAfterSubmission; + @BeforeEach + void setUp() { + var userDetails = UserInfo.builder().uid(SYSTEM_USER_USER_ID).build(); + user = new User(SYSTEM_UPDATE_AUTH_TOKEN, userDetails); + when(idamService.retrieveSystemUpdateUserDetails()).thenReturn(user); + when(authTokenGenerator.generate()).thenReturn(TEST_SERVICE_AUTH_TOKEN); + } + @Test void shouldSetAwaitingHwfDecisionStateIfSoleCitizenNeedsHelpWithFees() { @@ -61,6 +94,7 @@ void shouldSetAwaitingHwfDecisionStateIfSoleCitizenNeedsHelpWithFees() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(AwaitingHWFDecision); + verify(ccdUpdateService).submitEvent(TEST_CASE_ID, SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); } @Test @@ -87,6 +121,7 @@ void shouldSetAwaitingPaymentStateIfJointAndOnlyOneCitizenNeedsHelpWithFees() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(AwaitingPayment); + verifyNoInteractions(ccdUpdateService); } @Test @@ -240,6 +275,7 @@ void shouldSetSubmittedStateIfApplicationIsNotAwaitingDocuments() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(Submitted); + verify(ccdUpdateService).submitEvent(TEST_CASE_ID, SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); } @Test diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java new file mode 100644 index 00000000000..8088d16847b --- /dev/null +++ b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java @@ -0,0 +1,79 @@ +package uk.gov.hmcts.divorce.systemupdate.event; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; +import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl; +import uk.gov.hmcts.ccd.sdk.api.CaseDetails; +import uk.gov.hmcts.ccd.sdk.api.Event; +import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; +import uk.gov.hmcts.ccd.sdk.type.TTL; +import uk.gov.hmcts.ccd.sdk.type.YesOrNo; +import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.divorcecase.model.UserRole; + +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThat; +import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; +import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; +import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; +import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; + +@ExtendWith(MockitoExtension.class) +class SystemUpdateTTLTest { + private CaseDetails beforeDetails; + + @InjectMocks + private SystemUpdateTTL systemUpdateTTL; + + @Test + void shouldAddConfigurationToConfigBuilder() { + final ConfigBuilderImpl configBuilder = createCaseDataConfigBuilder(); + + systemUpdateTTL.configure(configBuilder); + + assertThat(getEventsFrom(configBuilder).values()) + .extracting(Event::getId) + .contains(SYSTEM_UPDATE_TTL); + } + + @Test + void shouldSetSystemTTLForDraftStateAndTTLNotSetAboutToStartCallback() { + + CaseDetails beforeDetails = getCaseDetails(Draft); + + final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); + + assertThat(response.getData().getTimeToLive()).isNotNull(); + assertThat(response.getData().getTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); + assertThat(response.getData().getTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); + } + + + @Test + void shouldNotSetSystemTTLForDraftStateWhenTTLIsAlreadySetAboutToStartCallback() { + + CaseDetails beforeDetails = getCaseDetails(Draft); + LocalDate systemTTL = LocalDate.of(2024, 11, 5); + beforeDetails.getData().setTimeToLive(TTL.builder() + .systemTTL(systemTTL) + .suspended(YesOrNo.YES) + .build()); + + final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); + + assertThat(response.getData().getTimeToLive()).isNull(); + } + + private CaseDetails getCaseDetails(State state) { + return CaseDetails.builder() + .state(state) + .data(CaseData.builder() + + .build()) + .build(); + } +} From f307a096b24a4ded008b1455ba90f29e6b18a80d Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 13:11:48 +0000 Subject: [PATCH 03/17] NFDIV-4448: Fix case field id --- ccd-definitions/AuthorisationComplexType.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccd-definitions/AuthorisationComplexType.json b/ccd-definitions/AuthorisationComplexType.json index e92d7e8e0fe..4190c711269 100644 --- a/ccd-definitions/AuthorisationComplexType.json +++ b/ccd-definitions/AuthorisationComplexType.json @@ -27,7 +27,7 @@ {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationName", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PrepopulateToUsersOrganisation", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} + {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} ] From 5c26e1ccc49d83af0cfba911a7ecbfd1995d998b Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 13:53:50 +0000 Subject: [PATCH 04/17] NFDIV-4448: Add TTL_profile role --- .../uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java index c8822ed92ba..bf1ad456d5e 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java @@ -36,7 +36,8 @@ public class HighLevelDataSetupApp extends DataLoaderToDefinitionStore { new CcdRoleConfig("pui-case-manager", "PUBLIC"), new CcdRoleConfig("pui-finance-manager", "PUBLIC"), new CcdRoleConfig("pui-organisation-manager", "PUBLIC"), - new CcdRoleConfig("pui-user-manager", "PUBLIC") + new CcdRoleConfig("pui-user-manager", "PUBLIC"), + new CcdRoleConfig("TTL_profile", "PUBLIC"), }; private final CcdEnvironment environment; From e148803bfec5344a4e8f76f9137a1c6bffc759df Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 14:14:09 +0000 Subject: [PATCH 05/17] NFDIV-4448: Fix issue with type --- .../java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java index 255bf5d7157..532b1242967 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java @@ -333,6 +333,7 @@ public class CaseData { @CCD( label = "Resolved time to live", typeOverride = Collection, + typeParameterOverride ="TTL", access = {TtlProfileAccess.class} ) private TTL timeToLive; From 48e689f5f791ea3bcb4c0800f1943a5d8be80ef4 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 15:44:16 +0000 Subject: [PATCH 06/17] NFDIV-4448: Update field name --- .../citizen/event/CitizenUpdateApplication.java | 2 +- .../gov/hmcts/divorce/divorcecase/model/CaseData.java | 9 +++++---- .../divorce/systemupdate/event/SystemUpdateTTL.java | 6 +++--- .../systemupdate/event/SystemUpdateTTLTest.java | 10 +++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index cf2fff8ed1d..b90a93acaeb 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -62,7 +62,7 @@ public AboutToStartOrSubmitResponse aboutToSubmit(CaseDetails aboutToStart(final CaseDeta log.info("{} about to start callback invoked for Case Id: {}", SYSTEM_UPDATE_TTL, details.getId()); final CaseData caseData = details.getData(); - if (caseData.getTimeToLive() == null && details.getState() == Draft) { - caseData.setTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) + if (caseData.getRetainAndDisponseTimeToLive() == null && details.getState() == Draft) { + caseData.setRetainAndDisponseTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) .suspended(YesOrNo.NO) .build()); } else { - caseData.setTimeToLive(null); + caseData.setRetainAndDisponseTimeToLive(null); } return AboutToStartOrSubmitResponse.builder() diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java index 8088d16847b..bce9c558ba2 100644 --- a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java @@ -47,9 +47,9 @@ void shouldSetSystemTTLForDraftStateAndTTLNotSetAboutToStartCallback() { final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - assertThat(response.getData().getTimeToLive()).isNotNull(); - assertThat(response.getData().getTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); - assertThat(response.getData().getTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); + assertThat(response.getData().getRetainAndDisponseTimeToLive()).isNotNull(); + assertThat(response.getData().getRetainAndDisponseTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); + assertThat(response.getData().getRetainAndDisponseTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); } @@ -58,14 +58,14 @@ void shouldNotSetSystemTTLForDraftStateWhenTTLIsAlreadySetAboutToStartCallback() CaseDetails beforeDetails = getCaseDetails(Draft); LocalDate systemTTL = LocalDate.of(2024, 11, 5); - beforeDetails.getData().setTimeToLive(TTL.builder() + beforeDetails.getData().setRetainAndDisponseTimeToLive(TTL.builder() .systemTTL(systemTTL) .suspended(YesOrNo.YES) .build()); final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - assertThat(response.getData().getTimeToLive()).isNull(); + assertThat(response.getData().getRetainAndDisponseTimeToLive()).isNull(); } private CaseDetails getCaseDetails(State state) { From e9483927d9acb7c9d5b1357d1c8a1d17a8c668d5 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 15:45:54 +0000 Subject: [PATCH 07/17] NFDIV-4448: Update field name --- .../citizen/event/CitizenUpdateApplication.java | 2 +- .../gov/hmcts/divorce/divorcecase/model/CaseData.java | 2 +- .../divorce/systemupdate/event/SystemUpdateTTL.java | 6 +++--- .../systemupdate/event/SystemUpdateTTLTest.java | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index b90a93acaeb..7d45ef14d66 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -62,7 +62,7 @@ public AboutToStartOrSubmitResponse aboutToSubmit(CaseDetails aboutToStart(final CaseDeta log.info("{} about to start callback invoked for Case Id: {}", SYSTEM_UPDATE_TTL, details.getId()); final CaseData caseData = details.getData(); - if (caseData.getRetainAndDisponseTimeToLive() == null && details.getState() == Draft) { - caseData.setRetainAndDisponseTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) + if (caseData.getRetainAndDisposeTimeToLive() == null && details.getState() == Draft) { + caseData.setRetainAndDisposeTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) .suspended(YesOrNo.NO) .build()); } else { - caseData.setRetainAndDisponseTimeToLive(null); + caseData.setRetainAndDisposeTimeToLive(null); } return AboutToStartOrSubmitResponse.builder() diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java index bce9c558ba2..47160c4690e 100644 --- a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java @@ -47,9 +47,9 @@ void shouldSetSystemTTLForDraftStateAndTTLNotSetAboutToStartCallback() { final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - assertThat(response.getData().getRetainAndDisponseTimeToLive()).isNotNull(); - assertThat(response.getData().getRetainAndDisponseTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); - assertThat(response.getData().getRetainAndDisponseTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); + assertThat(response.getData().getRetainAndDisposeTimeToLive()).isNotNull(); + assertThat(response.getData().getRetainAndDisposeTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); + assertThat(response.getData().getRetainAndDisposeTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); } @@ -58,14 +58,14 @@ void shouldNotSetSystemTTLForDraftStateWhenTTLIsAlreadySetAboutToStartCallback() CaseDetails beforeDetails = getCaseDetails(Draft); LocalDate systemTTL = LocalDate.of(2024, 11, 5); - beforeDetails.getData().setRetainAndDisponseTimeToLive(TTL.builder() + beforeDetails.getData().setRetainAndDisposeTimeToLive(TTL.builder() .systemTTL(systemTTL) .suspended(YesOrNo.YES) .build()); final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - assertThat(response.getData().getRetainAndDisponseTimeToLive()).isNull(); + assertThat(response.getData().getRetainAndDisposeTimeToLive()).isNull(); } private CaseDetails getCaseDetails(State state) { From 94cfc0912df6c80797e83df91317c85c9a114202 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Mon, 6 Jan 2025 17:16:22 +0000 Subject: [PATCH 08/17] NFDIV:4448: Add cft lib manager role --- src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java | 3 ++- .../uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java index 2e7475dfed3..a79f5ef18c2 100644 --- a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java +++ b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java @@ -65,7 +65,8 @@ public void configure(CFTLib lib) throws Exception { "pui-case-manager", "pui-finance-manager", "pui-organisation-manager", - "pui-user-manager" + "pui-user-manager", + "idam:cft-ttl-manager" ); ResourceLoader resourceLoader = new DefaultResourceLoader(); diff --git a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java index bf1ad456d5e..1c2e765c095 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java @@ -38,6 +38,7 @@ public class HighLevelDataSetupApp extends DataLoaderToDefinitionStore { new CcdRoleConfig("pui-organisation-manager", "PUBLIC"), new CcdRoleConfig("pui-user-manager", "PUBLIC"), new CcdRoleConfig("TTL_profile", "PUBLIC"), + new CcdRoleConfig("idam:cft-ttl-manager", "PUBLIC") }; private final CcdEnvironment environment; From c67b4272aef747b9af065dca486679dbad5eb870 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Fri, 10 Jan 2025 15:53:12 +0000 Subject: [PATCH 09/17] NFDIV-4448: Add separte role to access profile class --- ccd-definitions/AuthorisationComplexType.json | 6 +++--- .../hmcts/divorce/cftlib/CftLibConfig.java | 3 ++- .../citizen/event/CitizenPaymentMade.java | 1 + .../citizen/event/RoleToAccessProfiles.java | 19 +++++++++++++++++++ .../service/task/SetStateAfterSubmission.java | 5 ----- .../systemupdate/event/SystemUpdateTTL.java | 7 ++----- 6 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java diff --git a/ccd-definitions/AuthorisationComplexType.json b/ccd-definitions/AuthorisationComplexType.json index 4190c711269..e92d7e8e0fe 100644 --- a/ccd-definitions/AuthorisationComplexType.json +++ b/ccd-definitions/AuthorisationComplexType.json @@ -27,7 +27,7 @@ {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationName", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PrepopulateToUsersOrganisation", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "timeToLive", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} ] diff --git a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java index a79f5ef18c2..87c81f53807 100644 --- a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java +++ b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java @@ -28,7 +28,7 @@ public class CftLibConfig implements CFTLibConfigurer { @Override public void configure(CFTLib lib) throws Exception { var users = Map.of( - "DivCaseWorkerUser@AAT.com", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta"), + "DivCaseWorkerUser@AAT.com", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta", "TTL_profile"), "DivCaseSuperUser@AAT.com", List.of( "caseworker", "caseworker-divorce", "caseworker-divorce-superuser", "caseworker-divorce-courtadmin_beta"), "TEST_CASE_WORKER_USER@mailinator.com", List.of("caseworker", "caseworker-divorce", "caseworker-divorce-courtadmin_beta"), @@ -66,6 +66,7 @@ public void configure(CFTLib lib) throws Exception { "pui-finance-manager", "pui-organisation-manager", "pui-user-manager", + "TTL_profile", "idam:cft-ttl-manager" ); diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenPaymentMade.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenPaymentMade.java index 452e331d23f..5a3e1275bdb 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenPaymentMade.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenPaymentMade.java @@ -46,6 +46,7 @@ public void configure(final ConfigBuilder configBuild .event(CITIZEN_PAYMENT_MADE) .forState(AwaitingPayment) .showCondition(NEVER_SHOW) + .ttlIncrement(36524) .name("Payment made") .description("Payment made") .retries(120, 120) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java new file mode 100644 index 00000000000..cf0cf46ab48 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java @@ -0,0 +1,19 @@ +package uk.gov.hmcts.divorce.citizen.event; + +import org.springframework.stereotype.Component; +import uk.gov.hmcts.ccd.sdk.api.CCDConfig; +import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; +import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.divorcecase.model.UserRole; +import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CFT_TTL_MANAGER; + +@Component +public class RoleToAccessProfiles implements CCDConfig { + + @Override + public void configure(final ConfigBuilder configBuilder) { + configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); + } +} + diff --git a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java index 2552f664340..dd7d18f81de 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java @@ -20,8 +20,6 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; -import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; - @Component @RequiredArgsConstructor @Slf4j @@ -54,15 +52,12 @@ public CaseDetails apply(final CaseDetails cas if (applicantNeedsHelpWithFees) { caseDetails.setState(AwaitingHWFDecision); - ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } else if (applicantIsAwaitingDocuments) { caseDetails.setState(AwaitingDocuments); - ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } else if (!application.hasBeenPaidFor()) { caseDetails.setState(AwaitingPayment); } else { caseDetails.setState(Submitted); - ccdUpdateService.submitEvent(caseDetails.getId(), SYSTEM_UPDATE_TTL, user, serviceAuthorization); } log.info("State set to {}, CaseID {}", caseDetails.getState(), caseDetails.getId()); diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java index 294c57e260a..4d287ad32b7 100644 --- a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java +++ b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java @@ -18,7 +18,6 @@ import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CFT_TTL_MANAGER; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; @@ -26,7 +25,7 @@ @Slf4j public class SystemUpdateTTL implements CCDConfig { - public static final String SYSTEM_UPDATE_TTL = "system-update-TTL"; + public static final String SYSTEM_UPDATE_TTL = "system-update-ttl"; private static final LocalDate CURRENT_DATE_PLUS_SIX_MONTH = LocalDate.now().plusMonths(6); @Override @@ -41,7 +40,7 @@ public void configure(final ConfigBuilder configBuild .description("Resolve time to live") .grant(CREATE_READ_UPDATE, TTL_PROFILE)); - configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); + // configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); } public AboutToStartOrSubmitResponse aboutToStart(final CaseDetails details) { @@ -53,8 +52,6 @@ public AboutToStartOrSubmitResponse aboutToStart(final CaseDeta caseData.setRetainAndDisposeTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) .suspended(YesOrNo.NO) .build()); - } else { - caseData.setRetainAndDisposeTimeToLive(null); } return AboutToStartOrSubmitResponse.builder() From fe86593883da5527f4baa76b3ed21c6ec769ca53 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Tue, 14 Jan 2025 12:41:47 +0000 Subject: [PATCH 10/17] NFDIV-4448: Fix issue with R&D config --- ccd-definitions/AuthorisationComplexType.json | 6 +++--- .../citizen/event/RoleToAccessProfiles.java | 19 ------------------- .../service/task/SetStateAfterSubmission.java | 12 +----------- .../divorce/divorcecase/model/UserRole.java | 1 - .../systemupdate/event/SystemUpdateTTL.java | 17 ++++++++++++++++- 5 files changed, 20 insertions(+), 35 deletions(-) delete mode 100644 src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java diff --git a/ccd-definitions/AuthorisationComplexType.json b/ccd-definitions/AuthorisationComplexType.json index e92d7e8e0fe..32bc31a29a1 100644 --- a/ccd-definitions/AuthorisationComplexType.json +++ b/ccd-definitions/AuthorisationComplexType.json @@ -27,7 +27,7 @@ {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "Organisation.OrganisationName", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PrepopulateToUsersOrganisation", "UserRole": "caseworker-approver", "CRUD": "CRU"}, {"CaseTypeID": "NFD", "CaseFieldID": "applicant2SolicitorOrganisationPolicy", "ListElementCode": "PreviousOrganisations", "UserRole": "caseworker-approver", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "CRU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CU"}, - {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CU"} + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "SystemTTL", "UserRole": "TTL_profile", "CRUD": "R"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "Suspended", "UserRole": "TTL_profile", "CRUD": "CRU"}, + {"CaseTypeID": "NFD", "CaseFieldID": "TTL", "ListElementCode": "OverrideTTL", "UserRole": "TTL_profile", "CRUD": "CRU"} ] diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java deleted file mode 100644 index cf0cf46ab48..00000000000 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/RoleToAccessProfiles.java +++ /dev/null @@ -1,19 +0,0 @@ -package uk.gov.hmcts.divorce.citizen.event; - -import org.springframework.stereotype.Component; -import uk.gov.hmcts.ccd.sdk.api.CCDConfig; -import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; -import uk.gov.hmcts.divorce.divorcecase.model.CaseData; -import uk.gov.hmcts.divorce.divorcecase.model.State; -import uk.gov.hmcts.divorce.divorcecase.model.UserRole; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CFT_TTL_MANAGER; - -@Component -public class RoleToAccessProfiles implements CCDConfig { - - @Override - public void configure(final ConfigBuilder configBuilder) { - configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); - } -} - diff --git a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java index dd7d18f81de..dd9e7dc1e27 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmission.java @@ -8,10 +8,6 @@ import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.task.CaseTask; -import uk.gov.hmcts.divorce.idam.IdamService; -import uk.gov.hmcts.divorce.idam.User; -import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; -import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; import static java.util.Objects.nonNull; import static org.springframework.util.CollectionUtils.isEmpty; @@ -20,15 +16,12 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; + @Component @RequiredArgsConstructor @Slf4j public class SetStateAfterSubmission implements CaseTask { - private final CcdUpdateService ccdUpdateService; - private final IdamService idamService; - private final AuthTokenGenerator authTokenGenerator; - @Override public CaseDetails apply(final CaseDetails caseDetails) { @@ -47,9 +40,6 @@ public CaseDetails apply(final CaseDetails cas boolean applicantNeedsHelpWithFees = (isSoleApplication && isHWFApplicant1) || (!isSoleApplication && isHWFApplicant1 && isHWFApplicant2); - final User user = idamService.retrieveSystemUpdateUserDetails(); - final String serviceAuthorization = authTokenGenerator.generate(); - if (applicantNeedsHelpWithFees) { caseDetails.setState(AwaitingHWFDecision); } else if (applicantIsAwaitingDocuments) { diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java index dc86da73e53..5458a99a01f 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRole.java @@ -18,7 +18,6 @@ public enum UserRole implements HasRole { NOC_APPROVER("caseworker-approver", "CRU"), RPA_ROBOT("caseworker-divorce-rparobot", "CRU"), TTL_PROFILE("TTL_profile", "CRU"), - CFT_TTL_MANAGER("idam:cft-ttl-manager", "CRU"), SOLICITOR("caseworker-divorce-solicitor", "CRU"), APPLICANT_1_SOLICITOR("[APPONESOLICITOR]", "CRU"), diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java index 4d287ad32b7..d07911599b1 100644 --- a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java +++ b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java @@ -14,6 +14,7 @@ import uk.gov.hmcts.divorce.divorcecase.model.UserRole; import java.time.LocalDate; +import java.util.Arrays; import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; @@ -38,9 +39,23 @@ public void configure(final ConfigBuilder configBuild .showCondition(NEVER_SHOW) .aboutToStartCallback(this::aboutToStart) .description("Resolve time to live") + .fields() + .complex(CaseData::getRetainAndDisposeTimeToLive) + .readonly(TTL::getSystemTTL) + .optional(TTL::getOverrideTTL) + .optional(TTL::getSuspended) + .done() + .done() .grant(CREATE_READ_UPDATE, TTL_PROFILE)); - // configBuilder.caseRoleToAccessProfile(CFT_TTL_MANAGER).accessProfiles("TTL_profile").build(); + Arrays.stream(UserRole.values()).forEach( + userRole -> { + if (userRole.getRole().contains("caseworker")) { + configBuilder.caseRoleToAccessProfile(userRole).legacyIdamRole() + .accessProfiles(userRole.getRole(), "TTL_profile").build(); + } + } + ); } public AboutToStartOrSubmitResponse aboutToStart(final CaseDetails details) { From 8737d58e14ac643966dec8d997cb3192c3fe01e2 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Tue, 14 Jan 2025 13:00:15 +0000 Subject: [PATCH 11/17] NFDIV-4448: Fix unit tests --- .../task/SetStateAfterSubmissionTest.java | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java b/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java index c231b732ede..083bc4bc971 100644 --- a/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/common/service/task/SetStateAfterSubmissionTest.java @@ -1,10 +1,8 @@ package uk.gov.hmcts.divorce.common.service.task; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; -import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.type.ListValue; @@ -15,19 +13,11 @@ import uk.gov.hmcts.divorce.divorcecase.model.Payment; import uk.gov.hmcts.divorce.divorcecase.model.ServiceMethod; import uk.gov.hmcts.divorce.divorcecase.model.State; -import uk.gov.hmcts.divorce.idam.IdamService; -import uk.gov.hmcts.divorce.idam.User; -import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; -import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; -import uk.gov.hmcts.reform.idam.client.models.UserInfo; import java.util.Set; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.NO; import static uk.gov.hmcts.ccd.sdk.type.YesOrNo.YES; import static uk.gov.hmcts.divorce.divorcecase.model.ApplicationType.JOINT_APPLICATION; @@ -41,38 +31,15 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; import static uk.gov.hmcts.divorce.divorcecase.model.State.WelshTranslationReview; import static uk.gov.hmcts.divorce.document.model.DocumentType.MARRIAGE_CERTIFICATE; -import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; -import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_UPDATE_AUTH_TOKEN; -import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_USER_USER_ID; import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_CASE_ID; -import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_SERVICE_AUTH_TOKEN; import static uk.gov.hmcts.divorce.testutil.TestDataHelper.caseData; @ExtendWith(MockitoExtension.class) class SetStateAfterSubmissionTest { - @Mock - private IdamService idamService; - - @Mock - private AuthTokenGenerator authTokenGenerator; - - @Mock - private CcdUpdateService ccdUpdateService; - - private User user; - @InjectMocks private SetStateAfterSubmission setStateAfterSubmission; - @BeforeEach - void setUp() { - var userDetails = UserInfo.builder().uid(SYSTEM_USER_USER_ID).build(); - user = new User(SYSTEM_UPDATE_AUTH_TOKEN, userDetails); - when(idamService.retrieveSystemUpdateUserDetails()).thenReturn(user); - when(authTokenGenerator.generate()).thenReturn(TEST_SERVICE_AUTH_TOKEN); - } - @Test void shouldSetAwaitingHwfDecisionStateIfSoleCitizenNeedsHelpWithFees() { @@ -94,7 +61,6 @@ void shouldSetAwaitingHwfDecisionStateIfSoleCitizenNeedsHelpWithFees() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(AwaitingHWFDecision); - verify(ccdUpdateService).submitEvent(TEST_CASE_ID, SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); } @Test @@ -121,7 +87,6 @@ void shouldSetAwaitingPaymentStateIfJointAndOnlyOneCitizenNeedsHelpWithFees() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(AwaitingPayment); - verifyNoInteractions(ccdUpdateService); } @Test @@ -275,7 +240,6 @@ void shouldSetSubmittedStateIfApplicationIsNotAwaitingDocuments() { final CaseDetails result = setStateAfterSubmission.apply(caseDetails); assertThat(result.getState()).isEqualTo(Submitted); - verify(ccdUpdateService).submitEvent(TEST_CASE_ID, SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); } @Test From c727eaebc6ddbef848ebc904cf2564113eea5175 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Tue, 14 Jan 2025 13:16:16 +0000 Subject: [PATCH 12/17] NFDIV-4448: Fix unit tests --- .../event/SystemUpdateTTLTest.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java index 47160c4690e..6c19030b0cb 100644 --- a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java @@ -8,7 +8,6 @@ import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.api.Event; import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; -import uk.gov.hmcts.ccd.sdk.type.TTL; import uk.gov.hmcts.ccd.sdk.type.YesOrNo; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; @@ -24,7 +23,6 @@ @ExtendWith(MockitoExtension.class) class SystemUpdateTTLTest { - private CaseDetails beforeDetails; @InjectMocks private SystemUpdateTTL systemUpdateTTL; @@ -52,22 +50,6 @@ void shouldSetSystemTTLForDraftStateAndTTLNotSetAboutToStartCallback() { assertThat(response.getData().getRetainAndDisposeTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); } - - @Test - void shouldNotSetSystemTTLForDraftStateWhenTTLIsAlreadySetAboutToStartCallback() { - - CaseDetails beforeDetails = getCaseDetails(Draft); - LocalDate systemTTL = LocalDate.of(2024, 11, 5); - beforeDetails.getData().setRetainAndDisposeTimeToLive(TTL.builder() - .systemTTL(systemTTL) - .suspended(YesOrNo.YES) - .build()); - - final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - - assertThat(response.getData().getRetainAndDisposeTimeToLive()).isNull(); - } - private CaseDetails getCaseDetails(State state) { return CaseDetails.builder() .state(state) From fd127c297d17981bac520814cd8cf912fb54e60c Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Tue, 14 Jan 2025 18:55:32 +0000 Subject: [PATCH 13/17] NFDIV-4448: Update TTL using significant events --- .../event/CaseworkerHWFPartPaymentMade.java | 1 + .../CaseworkerHwfApplicationAccepted.java | 1 + .../event/CaseworkerPaymentMade.java | 1 + .../event/CitizenCreateApplication.java | 1 + .../event/CitizenUpdateApplication.java | 4 +- .../model/access/RoleToAccessProfiles.java | 25 ++++++ .../event/SolicitorCreateApplication.java | 1 + .../event/SolicitorSubmitApplication.java | 1 + .../systemupdate/event/ManageCaseTtl.java | 43 +++++++++++ .../systemupdate/event/SystemUpdateTTL.java | 76 ------------------- .../event/CitizenUpdateApplicationTest.java | 4 +- .../systemupdate/event/ManageCaseTtlTest.java | 34 +++++++++ .../event/SystemUpdateTTLTest.java | 61 --------------- 13 files changed, 112 insertions(+), 141 deletions(-) create mode 100644 src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java create mode 100644 src/main/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java delete mode 100644 src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java create mode 100644 src/test/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtlTest.java delete mode 100644 src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java diff --git a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHWFPartPaymentMade.java b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHWFPartPaymentMade.java index 679afc32ea7..36c6eed756c 100644 --- a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHWFPartPaymentMade.java +++ b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHWFPartPaymentMade.java @@ -54,6 +54,7 @@ public void configure(final ConfigBuilder configBuild Submitted ) .name(EVENT_NAME_AND_DESCRIPTION) + .ttlIncrement(36524) .description(EVENT_NAME_AND_DESCRIPTION) .aboutToSubmitCallback(this::aboutToSubmit) .showEventNotes() diff --git a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHwfApplicationAccepted.java b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHwfApplicationAccepted.java index 585e67467bd..61f2b94baaa 100644 --- a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHwfApplicationAccepted.java +++ b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerHwfApplicationAccepted.java @@ -49,6 +49,7 @@ public void configure(final ConfigBuilder configBuild RequestedInformationSubmitted, AwaitingHWFEvidence ) + .ttlIncrement(36524) .name("HWF application accepted") .description("HWF application accepted") .aboutToSubmitCallback(this::aboutToSubmit) diff --git a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerPaymentMade.java b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerPaymentMade.java index 2eef4c860ed..cf9fb65d165 100644 --- a/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerPaymentMade.java +++ b/src/main/java/uk/gov/hmcts/divorce/caseworker/event/CaseworkerPaymentMade.java @@ -49,6 +49,7 @@ public void configure(final ConfigBuilder configBuild RequestedInformationSubmitted, AwaitingHWFEvidence ) + .ttlIncrement(36524) .name("Payment made") .description("Payment made") .aboutToSubmitCallback(this::aboutToSubmit) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenCreateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenCreateApplication.java index 7f352dfeb21..dcd3123b3f6 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenCreateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenCreateApplication.java @@ -39,6 +39,7 @@ public void configure(final ConfigBuilder configBuild .event(CITIZEN_CREATE) .initialState(Draft) .showCondition(NEVER_SHOW) + .ttlIncrement(180) .name("Create draft case") .description("Apply for a divorce or dissolution") .aboutToSubmitCallback(this::aboutToSubmit) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index 7d45ef14d66..8656e5a8ae0 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -29,7 +29,7 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.RequestedInformationSubmitted; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CREATOR; import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; -import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; +import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL; @Component @RequiredArgsConstructor @@ -66,7 +66,7 @@ public AboutToStartOrSubmitResponse aboutToSubmit(CaseDetailsbuilder() diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java new file mode 100644 index 00000000000..f49b856763d --- /dev/null +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java @@ -0,0 +1,25 @@ +package uk.gov.hmcts.divorce.divorcecase.model.access; + +import java.util.Arrays; +import org.springframework.stereotype.Component; +import uk.gov.hmcts.ccd.sdk.api.CCDConfig; +import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; +import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.divorcecase.model.UserRole; + +@Component +public class RoleToAccessProfiles implements CCDConfig { + + @Override + public void configure(ConfigBuilder configBuilder) { + Arrays.stream(UserRole.values()).forEach( + userRole -> { + if (userRole.getRole().contains("caseworker")) { + configBuilder.caseRoleToAccessProfile(userRole).legacyIdamRole() + .accessProfiles(userRole.getRole(), "TTL_profile").build(); + } + } + ); + } +} diff --git a/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorCreateApplication.java b/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorCreateApplication.java index 54bcd12ec59..31abd35f62b 100644 --- a/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorCreateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorCreateApplication.java @@ -131,6 +131,7 @@ private PageBuilder addEventConfig( .initialState(Draft) .name("Apply: divorce or dissolution") .description("Apply: divorce or dissolution") + .ttlIncrement(180) .showSummary() .showEventNotes() .endButtonLabel("Save Application") diff --git a/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorSubmitApplication.java b/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorSubmitApplication.java index 41a94278e27..8d33f6c45a8 100644 --- a/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorSubmitApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/solicitor/event/SolicitorSubmitApplication.java @@ -191,6 +191,7 @@ private PageBuilder addEventConfig(final ConfigBuilder { + + public static final String MANAGE_CASE_TTL = "manage-case-ttl"; + + @Override + public void configure(final ConfigBuilder configBuilder) { + + new PageBuilder(configBuilder + .event(MANAGE_CASE_TTL) + .forStates(Draft, AwaitingPayment) + .name("Resolve time to live") + .showCondition(NEVER_SHOW) + .description("Resolve time to live") + .fields() + .complex(CaseData::getRetainAndDisposeTimeToLive) + .readonly(TTL::getSystemTTL) + .optional(TTL::getOverrideTTL) + .optional(TTL::getSuspended) + .done() + .done() + .grant(CREATE_READ_UPDATE, TTL_PROFILE)); + } +} diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java deleted file mode 100644 index d07911599b1..00000000000 --- a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTL.java +++ /dev/null @@ -1,76 +0,0 @@ -package uk.gov.hmcts.divorce.systemupdate.event; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import uk.gov.hmcts.ccd.sdk.api.CCDConfig; -import uk.gov.hmcts.ccd.sdk.api.CaseDetails; -import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; -import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; -import uk.gov.hmcts.ccd.sdk.type.TTL; -import uk.gov.hmcts.ccd.sdk.type.YesOrNo; -import uk.gov.hmcts.divorce.common.ccd.PageBuilder; -import uk.gov.hmcts.divorce.divorcecase.model.CaseData; -import uk.gov.hmcts.divorce.divorcecase.model.State; -import uk.gov.hmcts.divorce.divorcecase.model.UserRole; - -import java.time.LocalDate; -import java.util.Arrays; - -import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; -import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingPayment; -import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; -import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.TTL_PROFILE; -import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; - -@Component -@Slf4j -public class SystemUpdateTTL implements CCDConfig { - - public static final String SYSTEM_UPDATE_TTL = "system-update-ttl"; - private static final LocalDate CURRENT_DATE_PLUS_SIX_MONTH = LocalDate.now().plusMonths(6); - - @Override - public void configure(final ConfigBuilder configBuilder) { - - new PageBuilder(configBuilder - .event(SYSTEM_UPDATE_TTL) - .forStates(Draft, AwaitingPayment) - .name("Resolve time to live") - .showCondition(NEVER_SHOW) - .aboutToStartCallback(this::aboutToStart) - .description("Resolve time to live") - .fields() - .complex(CaseData::getRetainAndDisposeTimeToLive) - .readonly(TTL::getSystemTTL) - .optional(TTL::getOverrideTTL) - .optional(TTL::getSuspended) - .done() - .done() - .grant(CREATE_READ_UPDATE, TTL_PROFILE)); - - Arrays.stream(UserRole.values()).forEach( - userRole -> { - if (userRole.getRole().contains("caseworker")) { - configBuilder.caseRoleToAccessProfile(userRole).legacyIdamRole() - .accessProfiles(userRole.getRole(), "TTL_profile").build(); - } - } - ); - } - - public AboutToStartOrSubmitResponse aboutToStart(final CaseDetails details) { - - log.info("{} about to start callback invoked for Case Id: {}", SYSTEM_UPDATE_TTL, details.getId()); - final CaseData caseData = details.getData(); - - if (caseData.getRetainAndDisposeTimeToLive() == null && details.getState() == Draft) { - caseData.setRetainAndDisposeTimeToLive(TTL.builder().systemTTL(CURRENT_DATE_PLUS_SIX_MONTH) - .suspended(YesOrNo.NO) - .build()); - } - - return AboutToStartOrSubmitResponse.builder() - .data(caseData) - .build(); - } -} diff --git a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java index 15e27afc3df..d34b7b56eee 100644 --- a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java @@ -24,7 +24,7 @@ import static uk.gov.hmcts.divorce.citizen.event.CitizenUpdateApplication.CITIZEN_UPDATE; import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; -import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; +import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_UPDATE_AUTH_TOKEN; @@ -70,7 +70,7 @@ void shouldCallSystemUpdateTTLEventForDraftStateAndTTLNotSetAboutToSubmitCallbac citizenUpdateApplication.aboutToSubmit(beforeDetails, beforeDetails); - verify(ccdUpdateService).submitEvent(beforeDetails.getId(), SYSTEM_UPDATE_TTL, user, TEST_SERVICE_AUTH_TOKEN); + verify(ccdUpdateService).submitEvent(beforeDetails.getId(), MANAGE_CASE_TTL, user, TEST_SERVICE_AUTH_TOKEN); } @Test diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtlTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtlTest.java new file mode 100644 index 00000000000..fb2961be690 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtlTest.java @@ -0,0 +1,34 @@ +package uk.gov.hmcts.divorce.systemupdate.event; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; +import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl; +import uk.gov.hmcts.ccd.sdk.api.Event; +import uk.gov.hmcts.divorce.divorcecase.model.CaseData; +import uk.gov.hmcts.divorce.divorcecase.model.State; +import uk.gov.hmcts.divorce.divorcecase.model.UserRole; + +import static org.assertj.core.api.Assertions.assertThat; +import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL; +import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; +import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; + +@ExtendWith(MockitoExtension.class) +class ManageCaseTtlTest { + + @InjectMocks + private ManageCaseTtl systemUpdateTTL; + + @Test + void shouldAddConfigurationToConfigBuilder() { + final ConfigBuilderImpl configBuilder = createCaseDataConfigBuilder(); + + systemUpdateTTL.configure(configBuilder); + + assertThat(getEventsFrom(configBuilder).values()) + .extracting(Event::getId) + .contains(MANAGE_CASE_TTL); + } +} diff --git a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java b/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java deleted file mode 100644 index 6c19030b0cb..00000000000 --- a/src/test/java/uk/gov/hmcts/divorce/systemupdate/event/SystemUpdateTTLTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package uk.gov.hmcts.divorce.systemupdate.event; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.junit.jupiter.MockitoExtension; -import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl; -import uk.gov.hmcts.ccd.sdk.api.CaseDetails; -import uk.gov.hmcts.ccd.sdk.api.Event; -import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; -import uk.gov.hmcts.ccd.sdk.type.YesOrNo; -import uk.gov.hmcts.divorce.divorcecase.model.CaseData; -import uk.gov.hmcts.divorce.divorcecase.model.State; -import uk.gov.hmcts.divorce.divorcecase.model.UserRole; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; -import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; -import static uk.gov.hmcts.divorce.systemupdate.event.SystemUpdateTTL.SYSTEM_UPDATE_TTL; -import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; -import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; - -@ExtendWith(MockitoExtension.class) -class SystemUpdateTTLTest { - - @InjectMocks - private SystemUpdateTTL systemUpdateTTL; - - @Test - void shouldAddConfigurationToConfigBuilder() { - final ConfigBuilderImpl configBuilder = createCaseDataConfigBuilder(); - - systemUpdateTTL.configure(configBuilder); - - assertThat(getEventsFrom(configBuilder).values()) - .extracting(Event::getId) - .contains(SYSTEM_UPDATE_TTL); - } - - @Test - void shouldSetSystemTTLForDraftStateAndTTLNotSetAboutToStartCallback() { - - CaseDetails beforeDetails = getCaseDetails(Draft); - - final AboutToStartOrSubmitResponse response = systemUpdateTTL.aboutToStart(beforeDetails); - - assertThat(response.getData().getRetainAndDisposeTimeToLive()).isNotNull(); - assertThat(response.getData().getRetainAndDisposeTimeToLive().getSystemTTL()).isEqualTo(LocalDate.now().plusMonths(6)); - assertThat(response.getData().getRetainAndDisposeTimeToLive().getSuspended()).isEqualTo(YesOrNo.NO); - } - - private CaseDetails getCaseDetails(State state) { - return CaseDetails.builder() - .state(state) - .data(CaseData.builder() - - .build()) - .build(); - } -} From 9284e270217eb43c2096e737392528f5a57baebc Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Wed, 15 Jan 2025 09:39:26 +0000 Subject: [PATCH 14/17] NFDIV-4448: Fix checkstyle --- .../divorce/divorcecase/model/access/RoleToAccessProfiles.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java index f49b856763d..eadbb858934 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.divorce.divorcecase.model.access; -import java.util.Arrays; import org.springframework.stereotype.Component; import uk.gov.hmcts.ccd.sdk.api.CCDConfig; import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; @@ -8,6 +7,8 @@ import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; +import java.util.Arrays; + @Component public class RoleToAccessProfiles implements CCDConfig { From 760eda19fd5bca468b63521042e6a559713904a2 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Wed, 15 Jan 2025 13:24:51 +0000 Subject: [PATCH 15/17] NFDIV-4448: Add new class for role to access profile mapping --- .../model/UserRolesForAccessProfiles.java | 34 +++++++++++++ .../model/access/RoleToAccessProfiles.java | 49 +++++++++++++------ 2 files changed, 69 insertions(+), 14 deletions(-) create mode 100644 src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRolesForAccessProfiles.java diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRolesForAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRolesForAccessProfiles.java new file mode 100644 index 00000000000..175e340b01c --- /dev/null +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/UserRolesForAccessProfiles.java @@ -0,0 +1,34 @@ +package uk.gov.hmcts.divorce.divorcecase.model; + +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.AllArgsConstructor; +import lombok.Getter; +import uk.gov.hmcts.ccd.sdk.api.HasRole; + +@AllArgsConstructor +@Getter +public enum UserRolesForAccessProfiles implements HasRole { + + CASE_WORKER("idam:caseworker-divorce-courtadmin_beta", "CRU"), + CASE_WORKER_BULK_SCAN("idam:caseworker-divorce-bulkscan", "CRU"), + LEGAL_ADVISOR("idam:caseworker-divorce-courtadmin-la", "CRU"), + SUPER_USER("idam:caseworker-divorce-superuser", "CRU"), + SYSTEMUPDATE("idam:caseworker-divorce-systemupdate", "CRUD"), + JUDGE("idam:caseworker-divorce-judge", "CRU"), + NOC_APPROVER("idam:caseworker-approver", "CRU"), + RPA_ROBOT("idam:caseworker-divorce-rparobot", "CRU"), + TTL_MANAGER("idam:cft-ttl-manager", "CRU"), + + SOLICITOR("idam:caseworker-divorce-solicitor", "CRU"), + APPLICANT_1_SOLICITOR("[APPONESOLICITOR]", "CRU"), + APPLICANT_2_SOLICITOR("[APPTWOSOLICITOR]", "CRU"), + ORGANISATION_CASE_ACCESS_ADMINISTRATOR("idam:caseworker-caa", "CRU"), + + CITIZEN("idam:citizen", "CRU"), + CREATOR("[CREATOR]", "CRU"), + APPLICANT_2("[APPLICANTTWO]", "CRU"); + + @JsonValue + private final String role; + private final String caseTypePermissions; +} diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java index eadbb858934..62e5f069a9b 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/access/RoleToAccessProfiles.java @@ -5,22 +5,43 @@ import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; -import uk.gov.hmcts.divorce.divorcecase.model.UserRole; - -import java.util.Arrays; +import uk.gov.hmcts.divorce.divorcecase.model.UserRolesForAccessProfiles; @Component -public class RoleToAccessProfiles implements CCDConfig { - +public class RoleToAccessProfiles implements CCDConfig { @Override - public void configure(ConfigBuilder configBuilder) { - Arrays.stream(UserRole.values()).forEach( - userRole -> { - if (userRole.getRole().contains("caseworker")) { - configBuilder.caseRoleToAccessProfile(userRole).legacyIdamRole() - .accessProfiles(userRole.getRole(), "TTL_profile").build(); - } - } - ); + public void configure(ConfigBuilder configBuilder) { + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CASE_WORKER) + .accessProfiles("caseworker-divorce-courtadmin_beta").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CASE_WORKER_BULK_SCAN) + .accessProfiles("caseworker-divorce-bulkscan").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.LEGAL_ADVISOR) + .accessProfiles("caseworker-divorce-courtadmin-la").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SUPER_USER) + .accessProfiles("caseworker-divorce-superuser").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SYSTEMUPDATE) + .accessProfiles("caseworker-divorce-systemupdate").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.JUDGE) + .accessProfiles("caseworker-divorce-judge").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.NOC_APPROVER) + .accessProfiles("caseworker-approver").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.RPA_ROBOT) + .accessProfiles("caseworker-divorce-rparobot").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.TTL_MANAGER) + .accessProfiles("TTL_profile").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.SOLICITOR) + .accessProfiles("caseworker-divorce-solicitor").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_1_SOLICITOR) + .accessProfiles("[APPONESOLICITOR]").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_2_SOLICITOR) + .accessProfiles("[APPTWOSOLICITOR]").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.ORGANISATION_CASE_ACCESS_ADMINISTRATOR) + .accessProfiles("caseworker-caa").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CITIZEN) + .accessProfiles("citizen").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.CREATOR) + .accessProfiles("[CREATOR]").build(); + configBuilder.caseRoleToAccessProfile(UserRolesForAccessProfiles.APPLICANT_2) + .accessProfiles("[APPLICANTTWO]").build(); } } From 62332ae4c247206e7f8b62ac1cfe730cdefa82ef Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Thu, 16 Jan 2025 10:46:21 +0000 Subject: [PATCH 16/17] NFDIV-4448: Remove unused code --- .../event/CitizenUpdateApplication.java | 34 ----------- .../event/CitizenUpdateApplicationTest.java | 61 ------------------- 2 files changed, 95 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java index 8656e5a8ae0..9f560b8371c 100644 --- a/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java +++ b/src/main/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplication.java @@ -1,19 +1,11 @@ package uk.gov.hmcts.divorce.citizen.event; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import uk.gov.hmcts.ccd.sdk.api.CCDConfig; -import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.api.ConfigBuilder; -import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; -import uk.gov.hmcts.divorce.idam.IdamService; -import uk.gov.hmcts.divorce.idam.User; -import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; -import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; import static uk.gov.hmcts.divorce.common.ccd.CcdPageConfiguration.NEVER_SHOW; import static uk.gov.hmcts.divorce.divorcecase.model.State.AwaitingApplicant1Response; @@ -29,19 +21,12 @@ import static uk.gov.hmcts.divorce.divorcecase.model.State.RequestedInformationSubmitted; import static uk.gov.hmcts.divorce.divorcecase.model.UserRole.CREATOR; import static uk.gov.hmcts.divorce.divorcecase.model.access.Permissions.CREATE_READ_UPDATE; -import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL; @Component -@RequiredArgsConstructor -@Slf4j public class CitizenUpdateApplication implements CCDConfig { public static final String CITIZEN_UPDATE = "citizen-update-application"; - private final CcdUpdateService ccdUpdateService; - private final IdamService idamService; - private final AuthTokenGenerator authTokenGenerator; - @Override public void configure(final ConfigBuilder configBuilder) { @@ -55,23 +40,4 @@ public void configure(final ConfigBuilder configBuild .description("Patch a divorce or dissolution") .grant(CREATE_READ_UPDATE, CREATOR); } - - public AboutToStartOrSubmitResponse aboutToSubmit(CaseDetails details, - CaseDetails beforeDetails) { - - CaseData caseData = details.getData(); - - //Set TTL for newly created cases from today's date to 6 months in future - if (caseData.getRetainAndDisposeTimeToLive() == null && details.getState() == Draft) { - final User user = idamService.retrieveSystemUpdateUserDetails(); - final String serviceAuthorization = authTokenGenerator.generate(); - - ccdUpdateService.submitEvent(details.getId(), MANAGE_CASE_TTL, user, serviceAuthorization); - } - - return AboutToStartOrSubmitResponse.builder() - .data(details.getData()) - .state(details.getState()) - .build(); - } } diff --git a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java index d34b7b56eee..f6077957a36 100644 --- a/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java +++ b/src/test/java/uk/gov/hmcts/divorce/citizen/event/CitizenUpdateApplicationTest.java @@ -3,47 +3,21 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; -import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.ccd.sdk.ConfigBuilderImpl; -import uk.gov.hmcts.ccd.sdk.api.CaseDetails; import uk.gov.hmcts.ccd.sdk.api.Event; import uk.gov.hmcts.divorce.divorcecase.model.CaseData; import uk.gov.hmcts.divorce.divorcecase.model.State; import uk.gov.hmcts.divorce.divorcecase.model.UserRole; -import uk.gov.hmcts.divorce.idam.IdamService; -import uk.gov.hmcts.divorce.idam.User; -import uk.gov.hmcts.divorce.systemupdate.service.CcdUpdateService; -import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator; -import uk.gov.hmcts.reform.idam.client.models.UserInfo; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; import static uk.gov.hmcts.divorce.citizen.event.CitizenUpdateApplication.CITIZEN_UPDATE; -import static uk.gov.hmcts.divorce.divorcecase.model.State.Draft; -import static uk.gov.hmcts.divorce.divorcecase.model.State.Submitted; -import static uk.gov.hmcts.divorce.systemupdate.event.ManageCaseTtl.MANAGE_CASE_TTL; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.createCaseDataConfigBuilder; import static uk.gov.hmcts.divorce.testutil.ConfigTestUtil.getEventsFrom; -import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_UPDATE_AUTH_TOKEN; -import static uk.gov.hmcts.divorce.testutil.TestConstants.SYSTEM_USER_USER_ID; -import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_CASE_ID; -import static uk.gov.hmcts.divorce.testutil.TestConstants.TEST_SERVICE_AUTH_TOKEN; @ExtendWith(MockitoExtension.class) class CitizenUpdateApplicationTest { - @Mock - private IdamService idamService; - - @Mock - private AuthTokenGenerator authTokenGenerator; - - @Mock - private CcdUpdateService ccdUpdateService; - @InjectMocks private CitizenUpdateApplication citizenUpdateApplication; @@ -57,39 +31,4 @@ void shouldAddConfigurationToConfigBuilder() { .extracting(Event::getId) .contains(CITIZEN_UPDATE); } - - @Test - void shouldCallSystemUpdateTTLEventForDraftStateAndTTLNotSetAboutToSubmitCallback() { - - var userDetails = UserInfo.builder().uid(SYSTEM_USER_USER_ID).build(); - var user = new User(SYSTEM_UPDATE_AUTH_TOKEN, userDetails); - when(idamService.retrieveSystemUpdateUserDetails()).thenReturn(user); - when(authTokenGenerator.generate()).thenReturn(TEST_SERVICE_AUTH_TOKEN); - - CaseDetails beforeDetails = getCaseDetails(Draft); - - citizenUpdateApplication.aboutToSubmit(beforeDetails, beforeDetails); - - verify(ccdUpdateService).submitEvent(beforeDetails.getId(), MANAGE_CASE_TTL, user, TEST_SERVICE_AUTH_TOKEN); - } - - @Test - void shouldNotCallSystemUpdateTTLEventForDraftStateAndTTLNotSetAboutToSubmitCallback() { - - CaseDetails beforeDetails = getCaseDetails(Submitted); - - citizenUpdateApplication.aboutToSubmit(beforeDetails, beforeDetails); - - verifyNoInteractions(ccdUpdateService); - } - - private CaseDetails getCaseDetails(State state) { - return CaseDetails.builder() - .id(TEST_CASE_ID) - .state(state) - .data(CaseData.builder() - - .build()) - .build(); - } } From b247bfe728e58339675c5eba7ea31075dfb099c2 Mon Sep 17 00:00:00 2001 From: FaisalMoJ Date: Fri, 17 Jan 2025 14:08:02 +0000 Subject: [PATCH 17/17] NFDIV-4448: Resolve PR comments --- src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java | 3 +-- .../uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java | 3 +-- .../java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java | 2 +- .../uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java index 87c81f53807..30e52deae91 100644 --- a/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java +++ b/src/cftlib/java/uk/gov/hmcts/divorce/cftlib/CftLibConfig.java @@ -66,8 +66,7 @@ public void configure(CFTLib lib) throws Exception { "pui-finance-manager", "pui-organisation-manager", "pui-user-manager", - "TTL_profile", - "idam:cft-ttl-manager" + "TTL_profile" ); ResourceLoader resourceLoader = new DefaultResourceLoader(); diff --git a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java index 1c2e765c095..00a91c6b362 100644 --- a/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java +++ b/src/main/java/uk/gov/hmcts/divorce/common/ccd/HighLevelDataSetupApp.java @@ -37,8 +37,7 @@ public class HighLevelDataSetupApp extends DataLoaderToDefinitionStore { new CcdRoleConfig("pui-finance-manager", "PUBLIC"), new CcdRoleConfig("pui-organisation-manager", "PUBLIC"), new CcdRoleConfig("pui-user-manager", "PUBLIC"), - new CcdRoleConfig("TTL_profile", "PUBLIC"), - new CcdRoleConfig("idam:cft-ttl-manager", "PUBLIC") + new CcdRoleConfig("TTL_profile", "PUBLIC") }; private final CcdEnvironment environment; diff --git a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java index e9e3a321568..c13573af181 100644 --- a/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java +++ b/src/main/java/uk/gov/hmcts/divorce/divorcecase/model/CaseData.java @@ -335,7 +335,7 @@ public class CaseData { @CCD( label = "Set up TTL", typeOverride = FieldType.TTL, - access = {TtlProfileAccess.class} + access = {TtlProfileAccess.class, SystemUpdateAndSuperUserAccess.class} ) private TTL retainAndDisposeTimeToLive; diff --git a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java index 86c2fd5e6f7..c3bdcd2542b 100644 --- a/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java +++ b/src/main/java/uk/gov/hmcts/divorce/systemupdate/event/ManageCaseTtl.java @@ -20,7 +20,7 @@ @Slf4j public class ManageCaseTtl implements CCDConfig { - public static final String MANAGE_CASE_TTL = "manage-case-ttl"; + public static final String MANAGE_CASE_TTL = "manageCaseTTL"; @Override public void configure(final ConfigBuilder configBuilder) {