Skip to content

Commit

Permalink
make exela criteria thread safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-saunders-cts committed Dec 9, 2024
1 parent 63bf637 commit 5745785
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
@Service
public class ExelaCriteriaService {

private ArrayList<ReturnedCaseDetails> filteredCases;
private static final LocalDateTime EARLIEST_DATE = LocalDateTime.parse("2019-03-31T23:59:59");

public List<ReturnedCaseDetails> getFilteredCases(List<ReturnedCaseDetails> cases) {
log.info("filtering {} cases", cases.size());
filteredCases = new ArrayList<>();
List<ReturnedCaseDetails> filteredCases = new ArrayList<>();
for (ReturnedCaseDetails caseItem : cases) {
if (caseItem.getData().getScannedDocuments() != null) {
scannedDocumentsFilter(caseItem);
scannedDocumentsFilter(caseItem, filteredCases);
}
}
filteredCases.sort(Comparator.comparing(o -> o.getData().getDeceasedSurname().toLowerCase()));
Expand All @@ -36,7 +35,9 @@ public List<ReturnedCaseDetails> getFilteredCases(List<ReturnedCaseDetails> case
return filteredCases;
}

private void scannedDocumentsFilter(ReturnedCaseDetails caseItem) {
private void scannedDocumentsFilter(
final ReturnedCaseDetails caseItem,
final List<ReturnedCaseDetails> filteredCases) {
for (CollectionMember<ScannedDocument> document : caseItem.getData().getScannedDocuments()) {
if (((DOC_TYPE_OTHER.equalsIgnoreCase(document.getValue().getType())
&& DOC_SUBTYPE_WILL.equalsIgnoreCase(document.getValue().getSubtype()))
Expand Down

0 comments on commit 5745785

Please sign in to comment.