Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1153,4 +1153,8 @@ public class PrlAppsConstants {
public static final String OPTION_SEND_OR_REPLY = "optionSendOrReply";
public static final String EMPTY_VALUE = "EMPTY_VALUE";

public static final String APPLICANTS_CONFIDENTIAL_DETAILS = "applicantsConfidentialDetails";
public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails";
public static final String C100_CHILDREN_CONFIDENTIAL_DETAILS = "childrenConfidentialDetails";
public static final String FL401_CHILDREN_CONFIDENTIAL_DETAILS = "fl401ChildrenConfidentialDetails";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.prl.services;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -22,6 +21,7 @@
import uk.gov.hmcts.reform.prl.models.dto.ccd.CaseData;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -31,7 +31,11 @@

import static java.util.Optional.ofNullable;
import static org.apache.commons.lang3.ObjectUtils.isNotEmpty;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.APPLICANTS_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.C100_CASE_TYPE;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.C100_CHILDREN_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.FL401_CHILDREN_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.enums.FL401OrderTypeEnum.occupationOrder;
import static uk.gov.hmcts.reform.prl.utils.ElementUtils.unwrapElements;

Expand All @@ -40,69 +44,12 @@
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ConfidentialityTabService {

private final ObjectMapper objectMapper;

public Map<String, Object> updateConfidentialityDetails(CaseData caseData) {

List<Element<ApplicantConfidentialityDetails>> applicantsConfidentialDetails = new ArrayList<>();
List<Element<ApplicantConfidentialityDetails>> respondentsConfidentialDetails = new ArrayList<>();

if (C100_CASE_TYPE.equalsIgnoreCase(caseData.getCaseTypeOfApplication())) {
Optional<List<Element<PartyDetails>>> applicantList = ofNullable(caseData.getApplicants());
if (applicantList.isPresent()) {
List<PartyDetails> applicants = caseData.getApplicants().stream()
.map(Element::getValue)
.toList();
applicantsConfidentialDetails = getConfidentialApplicantDetails(
applicants);
}

List<Element<ChildConfidentialityDetails>> childrenConfidentialDetails = getChildrenConfidentialDetails(caseData);

Optional<List<Element<PartyDetails>>> respondentList = ofNullable(caseData.getRespondents());
if (respondentList.isPresent()) {
List<PartyDetails> respondents = caseData.getRespondents().stream()
.map(Element::getValue)
.toList();
respondentsConfidentialDetails = getConfidentialApplicantDetails(
respondents);
}

return Map.of(
"applicantsConfidentialDetails",
applicantsConfidentialDetails,
"childrenConfidentialDetails",
childrenConfidentialDetails,
"respondentConfidentialDetails",
respondentsConfidentialDetails
);

return getC100ConfidentialityDetails(caseData);
} else {
if (null != caseData.getApplicantsFL401()) {
List<PartyDetails> fl401Applicant = List.of(caseData.getApplicantsFL401());
applicantsConfidentialDetails = getConfidentialApplicantDetails(
fl401Applicant);
}

if (null != caseData.getRespondentsFL401()) {
List<PartyDetails> fl401Respondent = List.of(caseData.getRespondentsFL401());
respondentsConfidentialDetails = getConfidentialApplicantDetails(
fl401Respondent);
}

List<Element<Fl401ChildConfidentialityDetails>> childrenConfidentialDetails = getFl401ChildrenConfidentialDetails(caseData);

return Map.of(
"applicantsConfidentialDetails",
applicantsConfidentialDetails,
"fl401ChildrenConfidentialDetails",
childrenConfidentialDetails,
"respondentConfidentialDetails",
respondentsConfidentialDetails
);

return getFL401ConfidentialityDetails(caseData);
}

}

public List<Element<ChildConfidentialityDetails>> getChildrenConfidentialDetails(CaseData caseData) {
Expand All @@ -125,7 +72,6 @@ public List<Element<ChildConfidentialityDetails>> getChildrenConfidentialDetails
return elementList;
}


public List<Element<ChildConfidentialityDetails>> getChildrenConfidentialDetails(List<Child> children) {
List<Element<ChildConfidentialityDetails>> childrenConfidentialDetails = new ArrayList<>();
for (Child child : children) {
Expand Down Expand Up @@ -374,5 +320,64 @@ public List<Element<PartyDetails>> updateOtherPeopleConfidentiality(List<Element
})
.orElseGet(() -> null);
}
}

private Map<String, Object> getC100ConfidentialityDetails(CaseData caseData) {
List<Element<ApplicantConfidentialityDetails>> applicantsConfidentialDetails = getApplicantConfidentialDetails(caseData);
List<Element<ApplicantConfidentialityDetails>> respondentsConfidentialDetails = getRespondentConfidentialDetails(caseData);
List<Element<ChildConfidentialityDetails>> childrenConfidentialDetails = getChildrenConfidentialDetails(caseData);

return Map.of(
APPLICANTS_CONFIDENTIAL_DETAILS, applicantsConfidentialDetails,
C100_CHILDREN_CONFIDENTIAL_DETAILS, childrenConfidentialDetails,
RESPONDENT_CONFIDENTIAL_DETAILS, respondentsConfidentialDetails
);
}

private Map<String, Object> getFL401ConfidentialityDetails(CaseData caseData) {
List<Element<ApplicantConfidentialityDetails>> applicantsConfidentialDetails = new ArrayList<>();
List<Element<ApplicantConfidentialityDetails>> respondentsConfidentialDetails = new ArrayList<>();

if (null != caseData.getApplicantsFL401()) {
List<PartyDetails> fl401Applicant = List.of(caseData.getApplicantsFL401());
applicantsConfidentialDetails = getConfidentialApplicantDetails(fl401Applicant);
}

if (null != caseData.getRespondentsFL401()) {
List<PartyDetails> fl401Respondent = List.of(caseData.getRespondentsFL401());
respondentsConfidentialDetails = getConfidentialApplicantDetails(
fl401Respondent);
}

List<Element<Fl401ChildConfidentialityDetails>> childrenConfidentialDetails = getFl401ChildrenConfidentialDetails(caseData);

return Map.of(
APPLICANTS_CONFIDENTIAL_DETAILS, applicantsConfidentialDetails,
FL401_CHILDREN_CONFIDENTIAL_DETAILS, childrenConfidentialDetails,
RESPONDENT_CONFIDENTIAL_DETAILS, respondentsConfidentialDetails
);
}

private List<Element<ApplicantConfidentialityDetails>> getApplicantConfidentialDetails(CaseData caseData) {
Optional<List<Element<PartyDetails>>> applicantList = ofNullable(caseData.getApplicants());
if (applicantList.isPresent()) {
List<PartyDetails> applicants = caseData.getApplicants().stream()
.map(Element::getValue)
.toList();
return getConfidentialApplicantDetails(applicants);
} else {
return Collections.emptyList();
}
}

private List<Element<ApplicantConfidentialityDetails>> getRespondentConfidentialDetails(CaseData caseData) {
Optional<List<Element<PartyDetails>>> respondentList = ofNullable(caseData.getRespondents());
if (respondentList.isPresent()) {
List<PartyDetails> respondents = caseData.getRespondents().stream()
.map(Element::getValue)
.toList();
return getConfidentialApplicantDetails(respondents);
} else {
return Collections.emptyList();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.REFUGE_DOCUMENTS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENTS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.TASK_LIST_VERSION_V2;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.TASK_LIST_VERSION_V3;
Expand All @@ -91,7 +92,6 @@
@Slf4j
public class UpdatePartyDetailsService {

public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails";
protected static final String[] HISTORICAL_DOC_TO_RETAIN_FOR_EVENTS = {CaseEvent.AMEND_APPLICANTS_DETAILS.getValue(),
CaseEvent.AMEND_RESPONDENTS_DETAILS.getValue(), CaseEvent.AMEND_OTHER_PEOPLE_IN_THE_CASE_REVISED.getValue()};
public static final String C_8_OF = "C8 of ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.LONDON_TIME_ZONE;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.NEW_CHILDREN;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESPONDENT_CONFIDENTIAL_DETAILS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.RESP_CHILD_ABUSES_DOCMOSIS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR_C1A_DRAFT_DOCUMENT;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.SOLICITOR_C1A_FINAL_DOCUMENT;
Expand Down Expand Up @@ -146,7 +147,6 @@ public class C100RespondentSolicitorService {
public static final String RESPONSE_ALREADY_SUBMITTED_ERROR = "This event cannot be started as the response has already been submitted.";
public static final String SOLICITOR = " (Solicitor)";
public static final String RESPONDENT_DOCS_LIST = "respondentDocsList";
public static final String RESPONDENT_CONFIDENTIAL_DETAILS = "respondentConfidentialDetails";
public static final String IS_CONFIDENTIAL_DATA_PRESENT = "isConfidentialDataPresent";
public static final String EMAIL = "email";
public static final String PHONE = "phone";
Expand Down
Loading