-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* SSCS-10542 Set Aside * SSCS-10542 Adding Post Hearings feature flag * SSCS-10542 Map Action To Event * SSCS-10542 Feedback elseif to switch * SSCS-10542 Add set aside refused dwpState * reorder setting dwp state * SSCS-10542 Upgrade tests to Jupiter * Fixing test coverage * Fixing tests
- Loading branch information
1 parent
de3e6e5
commit 4ab0462
Showing
37 changed files
with
1,247 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ bin/ | |
/src/main/resources/uk/gov/hmcts/reform/sscs/git.properties | ||
|
||
*.hprof | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.copyableAnnotations+=org.springframework.beans.factory.annotation.Value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...submit/actionposthearingapplication/ActionPostHearingApplicationAboutToSubmitHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package uk.gov.hmcts.reform.sscs.ccd.presubmit.actionposthearingapplication; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Service; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.PreSubmitCallbackResponse; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.ActionPostHearingTypes; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.DocumentGeneration; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.DocumentStaging; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData; | ||
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler; | ||
import uk.gov.hmcts.reform.sscs.util.SscsUtil; | ||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class ActionPostHearingApplicationAboutToSubmitHandler implements PreSubmitCallbackHandler<SscsCaseData> { | ||
@Value("${feature.postHearings.enabled}") | ||
private final boolean isPostHearingsEnabled; | ||
|
||
@Override | ||
public boolean canHandle(CallbackType callbackType, Callback<SscsCaseData> callback) { | ||
requireNonNull(callback, "callback must not be null"); | ||
requireNonNull(callbackType, "callbacktype must not be null"); | ||
|
||
return callbackType.equals(CallbackType.ABOUT_TO_SUBMIT) | ||
&& callback.getEvent() == EventType.ACTION_POST_HEARING_APPLICATION | ||
&& isPostHearingsEnabled; | ||
} | ||
|
||
@Override | ||
public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType, Callback<SscsCaseData> callback, | ||
String userAuthorisation) { | ||
SscsCaseData caseData = callback.getCaseDetails().getCaseData(); | ||
|
||
PreSubmitCallbackResponse<SscsCaseData> response = new PreSubmitCallbackResponse<>(caseData); | ||
|
||
String caseId = caseData.getCcdCaseId(); | ||
if (!SscsUtil.isSAndLCase(caseData)) { | ||
log.info("Action Post Hearing Application: Cannot process non Scheduling & Listing Case for Case ID {}", | ||
caseId); | ||
response.addError("Cannot process Action Post Hearing Application on non Scheduling & Listing Case"); | ||
return response; | ||
} | ||
|
||
ActionPostHearingTypes typeSelected = caseData.getActionPostHearingApplication().getTypeSelected(); | ||
log.info("Action Post Hearing Application: handing action {} for case {}", typeSelected, caseId); | ||
|
||
clearTransientFields(caseData); | ||
|
||
return response; | ||
} | ||
|
||
private void clearTransientFields(SscsCaseData caseData) { | ||
caseData.setDocumentGeneration(DocumentGeneration.builder().build()); | ||
caseData.setDocumentStaging(DocumentStaging.builder().build()); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...d/presubmit/actionposthearingapplication/ActionPostHearingApplicationMidEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package uk.gov.hmcts.reform.sscs.ccd.presubmit.actionposthearingapplication; | ||
|
||
import static uk.gov.hmcts.reform.sscs.ccd.callback.DocumentType.DECISION_NOTICE; | ||
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.DECISION_ISSUED; | ||
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.isYes; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType; | ||
import uk.gov.hmcts.reform.sscs.ccd.callback.PreSubmitCallbackResponse; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.ActionPostHearingTypes; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData; | ||
import uk.gov.hmcts.reform.sscs.ccd.presubmit.IssueDocumentHandler; | ||
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler; | ||
import uk.gov.hmcts.reform.sscs.config.DocumentConfiguration; | ||
import uk.gov.hmcts.reform.sscs.docassembly.GenerateFile; | ||
import uk.gov.hmcts.reform.sscs.util.SscsUtil; | ||
|
||
@Component | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class ActionPostHearingApplicationMidEventHandler extends IssueDocumentHandler implements PreSubmitCallbackHandler<SscsCaseData> { | ||
public static final String PAGE_ID_GENERATE_NOTICE = "generateNotice"; | ||
private final DocumentConfiguration documentConfiguration; | ||
private final GenerateFile generateFile; | ||
@Value("${feature.postHearings.enabled}") | ||
private final boolean isPostHearingsEnabled; | ||
|
||
@Override | ||
public boolean canHandle(CallbackType callbackType, Callback<SscsCaseData> callback) { | ||
return callbackType.equals(CallbackType.MID_EVENT) | ||
&& callback.getEvent() == EventType.ACTION_POST_HEARING_APPLICATION | ||
&& isPostHearingsEnabled; | ||
} | ||
|
||
@Override | ||
public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType, Callback<SscsCaseData> callback, | ||
String userAuthorisation) { | ||
final SscsCaseData caseData = callback.getCaseDetails().getCaseData(); | ||
|
||
String pageId = callback.getPageId(); | ||
String caseId = caseData.getCcdCaseId(); | ||
log.info("Action Post Hearing Application: handling callback with pageId {} for caseId {}", pageId, caseId); | ||
|
||
PreSubmitCallbackResponse<SscsCaseData> response = new PreSubmitCallbackResponse<>(caseData); | ||
|
||
if (!SscsUtil.isSAndLCase(caseData)) { | ||
log.info("Action Post Hearing Application: Cannot process non Scheduling & Listing Case for Case ID {}", | ||
caseId); | ||
response.addError("Cannot process Action Post Hearing Application on non Scheduling & Listing Case"); | ||
return response; | ||
} | ||
|
||
ActionPostHearingTypes typeSelected = caseData.getActionPostHearingApplication().getTypeSelected(); | ||
log.info("Action Post Hearing Application: handing action {} for case {}", typeSelected, caseId); | ||
|
||
if (PAGE_ID_GENERATE_NOTICE.equals(pageId) && isYes(caseData.getDocumentGeneration().getGenerateNotice())) { | ||
log.info("Action Post Hearing Application: Generating notice for caseId {}", caseId); | ||
String templateId = documentConfiguration.getDocuments() | ||
.get(caseData.getLanguagePreference()).get(DECISION_ISSUED); | ||
response = issueDocument(callback, DECISION_NOTICE, templateId, generateFile, userAuthorisation); | ||
} | ||
|
||
return response; | ||
} | ||
} |
Oops, something went wrong.