-
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.
Implemented prePostHearing field in 'Send to interloc' and 'Send to J…
…udge' events (#3516) * SSCS-12139: implemented prePostHearing field in 'Send to interloc' and 'Send to Judge' events * common bump SSCS-12139 * cleanup, sscs-common bump * tests * fixed prePosthearing value is not null in about to start handler * Update build.gradle * update suppressions SSCS-12139 * update flags SSCS-12139 --------- Co-authored-by: Andrei Trushkov <andrei.trushkov@hmcts.net> Co-authored-by: NickHill111 <47982351+nickhill111@users.noreply.github.com> Co-authored-by: Nicholas Hill <nicholas.hill@HMCTS.net>
- Loading branch information
1 parent
70e24c6
commit 528ff6c
Showing
13 changed files
with
187 additions
and
70 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
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
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
46 changes: 46 additions & 0 deletions
46
...va/uk/gov/hmcts/reform/sscs/ccd/presubmit/sendtojudge/SendToJudgeAboutToStartHandler.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,46 @@ | ||
package uk.gov.hmcts.reform.sscs.ccd.presubmit.sendtojudge; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
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.EventType; | ||
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData; | ||
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler; | ||
|
||
@Component | ||
@Slf4j | ||
public class SendToJudgeAboutToStartHandler implements PreSubmitCallbackHandler<SscsCaseData> { | ||
private final boolean postHearingsB; | ||
|
||
public SendToJudgeAboutToStartHandler(@Value("${feature.postHearingsB.enabled}") boolean postHearingsB) { | ||
this.postHearingsB = postHearingsB; | ||
} | ||
|
||
@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_START) | ||
&& (callback.getEvent() == EventType.TCW_REFER_TO_JUDGE); | ||
} | ||
|
||
@Override | ||
public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType, Callback<SscsCaseData> callback, String userAuthorisation) { | ||
if (!canHandle(callbackType, callback)) { | ||
throw new IllegalStateException("Cannot handle callback"); | ||
} | ||
|
||
SscsCaseData sscsCaseData = callback.getCaseDetails().getCaseData(); | ||
if (postHearingsB) { | ||
sscsCaseData.setPrePostHearing(null); | ||
} | ||
|
||
return new PreSubmitCallbackResponse<>(sscsCaseData); | ||
} | ||
} |
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
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
Oops, something went wrong.