Skip to content

Commit

Permalink
DTSCCI-1093 adding log messages (#5755)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishikrsharma authored Oct 31, 2024
1 parent ad28357 commit ac999de
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
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.ccd.client.model.AboutToStartOrSubmitCallbackResponse;
Expand Down Expand Up @@ -33,6 +34,7 @@
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.GENERATE_RESPONSE_CUI_SEALED;
import static uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType.DEFENDANT_DEFENCE;

@Slf4j
@Service
@RequiredArgsConstructor
public class GenerateCUIResponseSealedFormCallBackHandler extends CallbackHandler {
Expand Down Expand Up @@ -64,22 +66,28 @@ public List<CaseEvent> handledEvents() {

private CallbackResponse prepareSealedForm(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
log.info("GENERATE_RESPONSE_CUI_SEALED for case {}", caseData.getCcdCaseReference());
CaseDocument sealedForm = formGenerator.generate(
caseData,
callbackParams.getParams().get(BEARER_TOKEN).toString()
);
log.info("sealedForm {} for case {}", sealedForm, caseData.getCcdCaseReference());
CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
log.info("isLipvLipOneVOne {} isLipVLipEnabled {} for case {}", caseData.isLipvLipOneVOne(),
featureToggleService.isLipVLipEnabled(), caseData.getCcdCaseReference());
if (stitchEnabled && caseData.isLipvLipOneVOne() && featureToggleService.isLipVLipEnabled()) {
log.info("if condition for case {}", caseData.getCcdCaseReference());
List<DocumentMetaData> documentMetaDataList = fetchDocumentsToStitch(caseData, sealedForm);
if (documentMetaDataList.size() > 1) {
log.info("documentMetaDataList {} for case {}", documentMetaDataList.size(), caseData.getCcdCaseReference());
CaseDocument stitchedDocument = civilDocumentStitchingService.bundle(
documentMetaDataList,
callbackParams.getParams().get(CallbackParams.Params.BEARER_TOKEN).toString(),
sealedForm.getDocumentName(),
sealedForm.getDocumentName(),
caseData
);

log.info("stitchedDocument {} for case {}", stitchedDocument, caseData.getCcdCaseReference());
CaseDocument updatedStitchedDoc = stitchedDocument.toBuilder().documentType(DEFENDANT_DEFENCE).build();
caseDataBuilder.respondent1ClaimResponseDocumentSpec(updatedStitchedDoc)
.systemGeneratedCaseDocuments(systemGeneratedDocumentService.getSystemGeneratedDocumentsWithAddedDocument(
Expand All @@ -89,6 +97,7 @@ private CallbackResponse prepareSealedForm(CallbackParams callbackParams) {
assignCategoryId.assignCategoryIdToCaseDocument(stitchedDocument, DocCategory.DEF1_DEFENSE_DQ.getValue());
}
} else {
log.info("Else sealedForm {} condition for case {}", sealedForm, caseData.getCcdCaseReference());
caseDataBuilder.respondent1ClaimResponseDocumentSpec(sealedForm)
.systemGeneratedCaseDocuments(systemGeneratedDocumentService.getSystemGeneratedDocumentsWithAddedDocument(
sealedForm,
Expand Down

0 comments on commit ac999de

Please sign in to comment.