Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DFR-3063/DFR-3195 Upload warnings on upload doc + NPE fix. #1788

Merged
merged 131 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
ba14d39
POC files
jthmcts Feb 29, 2024
c54ce1c
Merge branch 'master' into DFR-2737
Jun 10, 2024
3f1eb12
Missing @Component tag
Jun 10, 2024
9b9679f
Move the validation logic to AboutToSubmit event.
Jun 10, 2024
04367de
Fine tuning
Jun 10, 2024
cdad066
Test case for UploadGeneralDocumentService
Jun 11, 2024
49d1d2e
add one more test case and enable @ParameterizedTest
Jun 11, 2024
227e1f4
add a test that no new document uploaded.
Jun 11, 2024
5277377
test case for multiple upload documents
Jun 11, 2024
77f5491
Bug fix
Jun 12, 2024
e878653
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
Jun 12, 2024
fd33f0d
Fix test case
Jun 12, 2024
56ab916
rollback (+1 squashed commit)
Jun 12, 2024
ebedf0f
introduced DocumentUploadServiceV2
Jun 12, 2024
411cb25
adding back test case
Jun 12, 2024
f2001a2
update package
Jun 12, 2024
0b50608
add UploadDocumentConsentedAboutToSubmitHandler
Jun 12, 2024
11eb2f5
Fine tuning UploadDocumentContestedAboutToSubmitHandlerTest
Jun 12, 2024
a584ab5
missing new line
Jun 12, 2024
f3fd917
Introduced TestLogger
Jun 13, 2024
4da333d
missing new line
Jun 13, 2024
970a7ee
tidy up
Jun 13, 2024
6c3a06b
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 13, 2024
fde1a1b
update test cases
Jun 13, 2024
7fb756d
Decoupling
Jun 13, 2024
d600dbd
checkstyle
Jun 13, 2024
803b46c
revert it
Jun 13, 2024
9227760
decoupling the test case
Jun 13, 2024
f49bb49
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 13, 2024
e8b318d
To make test case much more generic.
Jun 13, 2024
e23a0c5
Merge branch 'DFR-3063-upload-warnings-on-upload-doc' of github.com:h…
Jun 13, 2024
c030503
Resolving code smells
Jun 13, 2024
bd56178
Resolving code smell and update test cases.
Jun 13, 2024
0496e49
update RespondentNameDocumentContentChecker
Jun 14, 2024
4a20a22
Test cases for ApplicantNameDocumentContentChecker
Jun 14, 2024
648934d
Remove unused class
Jun 14, 2024
5359911
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
Jun 14, 2024
ce4d1b1
Test case for DocumentCheckerService
Jun 14, 2024
281c65d
Add test case for the logger.
Jun 14, 2024
ec5001a
add missing case - removing the existing doc.
Jun 14, 2024
e3a3944
update test cases
Jun 14, 2024
8e8025f
fixing test case for removing existing doc
Jun 14, 2024
4d55942
Add testNoDocumentCheckerCanCheck
Jun 14, 2024
7e76c84
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 17, 2024
0a9e580
Write test case for DocxDocumentChecker
Jun 17, 2024
34e8e9e
Test cases for CaseNumberDocumentContentChecker
Jun 17, 2024
f1e3b29
Test case for DuplicateFilenameDocumentChecker
Jun 17, 2024
5ddab68
Unit tests for PdfDocumentChecker
Jun 17, 2024
2e586fb
Introducing PdfDocumentReader and DocxDocumentReader
Jun 17, 2024
383ca06
checkstyle
Jun 17, 2024
adc2dbe
remove an extra space.
Jun 17, 2024
7de99c0
Fix parameters
Jun 17, 2024
47b7f72
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 18, 2024
e7d739f
missing newline at the end of file.
Jun 18, 2024
9572ee2
Merge branch 'DFR-3063-upload-warnings-on-upload-doc' of github.com:h…
Jun 18, 2024
ad3b23b
Simplified the test case.
Jun 18, 2024
f52bf7f
Update DocumentContentChecker and its test cases
Jun 18, 2024
34958b7
typo
Jun 18, 2024
4e5bb59
added comment on DocumentUploadServiceV2
Jun 18, 2024
41e3f2b
Renaming service to NewUploadedDocumentsService
Jun 19, 2024
aee987f
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 19, 2024
4335d62
Resolve code review conversation.
Jun 19, 2024
2e7ef27
remove unnecessary line of code.
Jun 19, 2024
419c9dc
null checking
Jun 19, 2024
f25f5ad
Fix missing test case
Jun 19, 2024
7d579ca
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 19, 2024
4368758
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 21, 2024
6dd5ea5
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 24, 2024
2a71a7a
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
Jun 25, 2024
50dbfee
Fix consented flow as respondent name stored in other fields
Jun 25, 2024
293e4ca
remove blank new
Jun 25, 2024
d95b923
Unit tests for the latest fix
Jun 25, 2024
f73b62c
Remove duplicated codes in the test case
Jun 25, 2024
3698a1d
eliminate duplicated warning messages
Jun 25, 2024
967138f
(Half Done) update the logic in duplicated filename checker
Jun 25, 2024
368cd34
Introduced interface CaseDocumentsDiscovery
Jun 27, 2024
b94bf8f
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 27, 2024
e7b28cf
Remove commented codes
Jun 27, 2024
ecc084c
checkstyle fix
Jun 27, 2024
b1a212c
Implementing CaseDocumentsDiscovery (continue)
Jun 27, 2024
6c88e19
Implementing CaseDocumentsDiscovery (continue)
Jun 27, 2024
28fa908
Implementing CaseDocumentsDiscovery (continue)
Jun 27, 2024
8a00fe7
Remove logging
Jun 27, 2024
c79c500
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jun 28, 2024
5c8ee1f
Implements HasCaseDocument
Jun 28, 2024
d3c27bb
Checkstyle fix and add interface to GeneralEmailWrapper
Jun 28, 2024
eea6dbf
Support Document as well.
Jun 28, 2024
f0f8ce5
update test cases
Jun 28, 2024
a08a855
Simplified the logic
Jun 28, 2024
d7a297d
Check the duplication on uploading documents.
Jun 28, 2024
9336605
checkstyle
Jun 28, 2024
21427dd
Bug fix and skip the first match
Jun 28, 2024
38e529e
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 1, 2024
ed30fe2
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 1, 2024
4946ef9
Remove checking null logic and an unnecessary log.
Jul 1, 2024
4bf6010
typo
Jul 1, 2024
b4c259b
Added a Javadoc
Jul 1, 2024
b84d6b5
Use Builder pattern for the parameters
Jul 2, 2024
3d0af6b
Modify CaseNumberDocumentContentChecker to detect "Case No" and "Refe…
Jul 4, 2024
a3e9fdd
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 4, 2024
d4c6e99
Add warning messages with character to capture the sorting behavior
Jul 5, 2024
8530e30
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 8, 2024
83469f8
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 9, 2024
40bd76e
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 10, 2024
0a4b54d
update test case
Jul 10, 2024
d2bcece
Merge branch 'DFR-3063-upload-warnings-on-upload-doc' of github.com:h…
Jul 10, 2024
3a4ad8a
typo
Jul 10, 2024
c7c535f
Revert @Setter annotations. and use @Builder(toBuilder= true) in Finr…
Jul 10, 2024
81472e2
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 11, 2024
28bceb0
Fixing failed test case.
Jul 11, 2024
9b3d3c8
Revert "Update dependency org.apache.poi:poi-ooxml to v5.3.0 (#1762)"
Jul 11, 2024
e7b8c54
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 12, 2024
3e48cd5
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 15, 2024
d0c7664
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 15, 2024
5ce7a15
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
Jul 17, 2024
534a291
Log messages improvement.
Jul 17, 2024
4935187
DFR-3195 Fixing null documentlink
Jul 17, 2024
30319d5
Test case updated.
Jul 17, 2024
6dd3dd5
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 17, 2024
d720499
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 18, 2024
5aed595
resolve merge error unit test
Jul 18, 2024
dbe8f6e
Fix test case
Jul 18, 2024
a585c15
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 19, 2024
b20fc27
Wrap the warnings check in an exception block
Jul 19, 2024
3d8b475
DFR-3197 - Upload document warnings causes NPE because "hcd" is null
Jul 19, 2024
e2ea109
Handling the case when documentLink is null
Jul 19, 2024
97ebea6
DFR-3198 Upload document warnings causes java.lang.NumberFormatException
Jul 19, 2024
7c5a8a7
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 22, 2024
18511be
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 22, 2024
b8cb4fc
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 23, 2024
375faad
Merge branch 'master' into DFR-3063-upload-warnings-on-upload-doc
so99y Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ dependencies {
implementation("org.apache.poi:poi:5.3.0") {
exclude group: "org.apache.commons", module: "commons-math3"
}
implementation("org.apache.poi:poi-ooxml:5.3.0") {
implementation("org.apache.poi:poi-ooxml:5.2.5") {
exclude group: "org.apache.commons", module: "commons-math3"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package uk.gov.hmcts.reform.finrem.caseorchestration.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import uk.gov.hmcts.reform.finrem.caseorchestration.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.finrem.caseorchestration.controllers.GenericAboutToStartOrSubmitCallbackResponse;
import uk.gov.hmcts.reform.finrem.caseorchestration.mapper.FinremCaseDetailsMapper;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.EventType;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseType;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.UploadDocumentCollection;
import uk.gov.hmcts.reform.finrem.caseorchestration.service.NewUploadedDocumentsService;
import uk.gov.hmcts.reform.finrem.caseorchestration.service.documentchecker.DocumentCheckerService;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static java.lang.String.format;

@Slf4j
@Service
public class UploadDocumentConsentedAboutToSubmitHandler extends FinremCallbackHandler {

private final DocumentCheckerService documentCheckerService;
private final NewUploadedDocumentsService newUploadedDocumentsService;

public UploadDocumentConsentedAboutToSubmitHandler(FinremCaseDetailsMapper mapper,
DocumentCheckerService documentCheckerService,
NewUploadedDocumentsService newUploadedDocumentsService) {
super(mapper);
this.documentCheckerService = documentCheckerService;
this.newUploadedDocumentsService = newUploadedDocumentsService;
}

@Override
public boolean canHandle(CallbackType callbackType, CaseType caseType, EventType eventType) {
return CallbackType.ABOUT_TO_SUBMIT.equals(callbackType)
&& CaseType.CONSENTED.equals(caseType)
&& EventType.UPLOAD_DOCUMENT_CONSENTED.equals(eventType);
}

@Override
@SuppressWarnings("squid:CallToDeprecatedMethod")
public GenericAboutToStartOrSubmitCallbackResponse<FinremCaseData> handle(FinremCallbackRequest callbackRequest,
String userAuthorisation) {
FinremCaseDetails beforeFinremCaseDetails = callbackRequest.getCaseDetailsBefore();
FinremCaseDetails finremCaseDetails = callbackRequest.getCaseDetails();
FinremCaseData caseData = finremCaseDetails.getData();
FinremCaseData caseDataBefore = callbackRequest.getCaseDetailsBefore().getData();
final Long caseId = finremCaseDetails.getId();

List<UploadDocumentCollection> newDocuments = newUploadedDocumentsService.getNewUploadDocuments(caseData, caseDataBefore,
FinremCaseData::getUploadDocuments);

Set<String> allWarnings = new HashSet<>();
for (UploadDocumentCollection doc : newDocuments) {
if (doc.getValue() != null && doc.getValue().getDocumentLink() != null) {
try {
List<String> warnings = documentCheckerService.getWarnings(doc.getValue().getDocumentLink(), beforeFinremCaseDetails,
finremCaseDetails, userAuthorisation);
if (!ObjectUtils.isEmpty(warnings)) {
allWarnings.addAll(warnings);
}
} catch (Exception t) {
log.error(format("%s - Exception was caught when checking the warnings", caseId), t);
}
}
}

if (!allWarnings.isEmpty()) {
log.info(format("%s - Number of warnings encountered when uploading document: %s",
caseId, allWarnings.size()));
}

return GenericAboutToStartOrSubmitCallbackResponse.<FinremCaseData>builder()
.warnings((allWarnings.stream().sorted().toList()))
.data(caseData).build();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package uk.gov.hmcts.reform.finrem.caseorchestration.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import uk.gov.hmcts.reform.finrem.caseorchestration.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.finrem.caseorchestration.controllers.GenericAboutToStartOrSubmitCallbackResponse;
import uk.gov.hmcts.reform.finrem.caseorchestration.mapper.FinremCaseDetailsMapper;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.EventType;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseType;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseData;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.UploadGeneralDocument;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.UploadGeneralDocumentCollection;
import uk.gov.hmcts.reform.finrem.caseorchestration.service.NewUploadedDocumentsService;
import uk.gov.hmcts.reform.finrem.caseorchestration.service.documentcatergory.UploadGeneralDocumentsCategoriser;
import uk.gov.hmcts.reform.finrem.caseorchestration.service.documentchecker.DocumentCheckerService;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static java.lang.String.format;
import static java.util.Comparator.comparing;
import static java.util.Comparator.nullsLast;
import static java.util.Optional.ofNullable;

@Slf4j
@Service
public class UploadDocumentContestedAboutToSubmitHandler extends FinremCallbackHandler {

private final DocumentCheckerService documentCheckerService;
private final NewUploadedDocumentsService newUploadedDocumentsService;
private final UploadGeneralDocumentsCategoriser uploadGeneralDocumentsCategoriser;

public UploadDocumentContestedAboutToSubmitHandler(FinremCaseDetailsMapper mapper,
DocumentCheckerService documentCheckerService,
NewUploadedDocumentsService newUploadedDocumentsService,
UploadGeneralDocumentsCategoriser uploadGeneralDocumentsCategoriser) {
super(mapper);
this.documentCheckerService = documentCheckerService;
this.newUploadedDocumentsService = newUploadedDocumentsService;
this.uploadGeneralDocumentsCategoriser = uploadGeneralDocumentsCategoriser;
}

@Override
public boolean canHandle(CallbackType callbackType, CaseType caseType, EventType eventType) {
return CallbackType.ABOUT_TO_SUBMIT.equals(callbackType)
&& CaseType.CONTESTED.equals(caseType)
&& EventType.UPLOAD_DOCUMENT_CONTESTED.equals(eventType);
}

@Override
@SuppressWarnings("squid:CallToDeprecatedMethod")
public GenericAboutToStartOrSubmitCallbackResponse<FinremCaseData> handle(FinremCallbackRequest callbackRequest,
String userAuthorisation) {
FinremCaseDetails beforeFinremCaseDetails = callbackRequest.getCaseDetailsBefore();
FinremCaseDetails finremCaseDetails = callbackRequest.getCaseDetails();
FinremCaseData caseData = finremCaseDetails.getData();
FinremCaseData caseDataBefore = callbackRequest.getCaseDetailsBefore().getData();
final Long caseId = finremCaseDetails.getId();

List<UploadGeneralDocumentCollection> newDocuments = newUploadedDocumentsService.getNewUploadDocuments(caseData, caseDataBefore,
FinremCaseData::getUploadGeneralDocuments);

Set<String> allWarnings = new HashSet<>();
for (UploadGeneralDocumentCollection doc : newDocuments) {
if (doc.getValue() != null && doc.getValue().getDocumentLink() != null) {
try {
List<String> warnings = documentCheckerService.getWarnings(doc.getValue().getDocumentLink(), beforeFinremCaseDetails,
finremCaseDetails, userAuthorisation);
if (!ObjectUtils.isEmpty(warnings)) {
allWarnings.addAll(warnings);
}
} catch (Exception t) {
log.error(format("%s - Exception was caught when checking the warnings", caseId), t);
}
}
}

if (!allWarnings.isEmpty()) {
log.info(format("%s - Number of warnings encountered when uploading general document: %s",
caseId, allWarnings.size()));
}

// Do sorting
List<UploadGeneralDocumentCollection> uploadedDocuments = new ArrayList<>(ofNullable(caseData.getUploadGeneralDocuments())
.orElse(List.of()));
uploadedDocuments.sort(comparing(UploadGeneralDocumentCollection::getValue,
comparing(UploadGeneralDocument::getGeneralDocumentUploadDateTime, nullsLast(Comparator.reverseOrder()))));
caseData.setUploadGeneralDocuments(uploadedDocuments);

// Execute the categoriser for CFV
uploadGeneralDocumentsCategoriser.categorise(caseData);

return GenericAboutToStartOrSubmitCallbackResponse.<FinremCaseData>builder()
.warnings(allWarnings.stream().sorted().toList())
.data(caseData).build();
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package uk.gov.hmcts.reform.finrem.caseorchestration.model;

import lombok.Builder;
import lombok.Getter;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.CaseDocument;
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.FinremCaseDetails;

@Builder
@Getter
public class DocumentCheckContext {
private CaseDocument caseDocument;
private byte[] bytes;
private FinremCaseDetails beforeCaseDetails;
private FinremCaseDetails caseDetails;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public enum EventType {
PREPARE_FOR_HEARING("FR_prepareForHearing"),
UPLOAD_CASE_FILES("FR_uploadCaseFiles"),
UPLOAD_CONFIDENTIAL_DOCUMENT("FR_uploadConfidentialDocument"),
UPLOAD_GENERAL_DOCUMENT("FR_uploadGeneralDocument"),
UPLOAD_DOCUMENT_CONSENTED("FR_uploadDocument"),
UPLOAD_DOCUMENT_CONTESTED("FR_uploadGeneralDocument"),
INTERIM_HEARING("FR_listForInterimHearing"),
SOLICITOR_CREATE("FR_solicitorCreate"),
AMEND_APP_DETAILS("FR_amendApplicationDetails"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AdditionalHearingDocument {
public class AdditionalHearingDocument implements HasCaseDocument {
@JsonProperty("additionalHearingDocument")
private CaseDocument document;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AdditionalHearingDocumentCollection {
public class AdditionalHearingDocumentCollection implements HasCaseDocument {
private AdditionalHearingDocument value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@AllArgsConstructor
@NoArgsConstructor
@SuppressWarnings("java:S1700")
public class AmendedConsentOrder {
public class AmendedConsentOrder implements HasCaseDocument {
@JsonProperty("amendedConsentOrder")
private CaseDocument amendedConsentOrder;
@JsonProperty("amendedConsentOrderDate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AmendedConsentOrderCollection {
public class AmendedConsentOrderCollection implements HasCaseDocument {
private AmendedConsentOrder value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ApproveOrder {
public class ApproveOrder implements HasCaseDocument {

@JsonProperty("approveOrder")
CaseDocument caseDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ApproveOrdersHolder {
public class ApproveOrdersHolder implements HasCaseDocument {
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime orderReceivedAt;
private List<ApprovedOrderCollection> approveOrders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ApprovedOrder {
public class ApprovedOrder implements HasCaseDocument {
@JsonProperty("orderLetter")
private CaseDocument orderLetter;
@JsonProperty("consentOrder")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ApprovedOrderCollection {
public class ApprovedOrderCollection implements HasCaseDocument {

@JsonProperty("id")
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ApprovedOrderConsolidateCollection {
public class ApprovedOrderConsolidateCollection implements HasCaseDocument {

private ApproveOrdersHolder value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@AllArgsConstructor
@EqualsAndHashCode
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CaseDocument {
public class CaseDocument implements DocumentFileNameProvider {

@JsonProperty("document_url")
private String documentUrl;
Expand All @@ -41,4 +41,8 @@ public CaseDocument(CaseDocument caseDocuments) {
this.categoryId = caseDocuments.getCategoryId();
this.uploadTimestamp = caseDocuments.getUploadTimestamp();
}

public String getDocumentUrl() {
return this.documentUrl == null ? "" : this.documentUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd;

public interface CaseDocumentCollection<T extends HasDocumentLink> {
T getValue();
}
Loading