Skip to content

Commit

Permalink
Revert "CIV-10382 Case flags updates for new experts/witnesses (#3296)…
Browse files Browse the repository at this point in the history
…" (#3591)

This reverts commit 652e890.
  • Loading branch information
HarryH96 authored Nov 17, 2023
1 parent 652e890 commit 7d4c833
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 617 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.LitigationFriend;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.model.PartyFlagStructure;
import uk.gov.hmcts.reform.civil.model.UpdateDetailsForm;
import uk.gov.hmcts.reform.civil.model.UpdatePartyDetailsForm;
import uk.gov.hmcts.reform.civil.model.common.DynamicList;
Expand Down Expand Up @@ -50,7 +49,8 @@
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.getMultiPartyScenario;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.unwrapElements;
import static uk.gov.hmcts.reform.civil.utils.CaseFlagUtils.addApplicantExpertAndWitnessFlagsStructure;
import static uk.gov.hmcts.reform.civil.utils.CaseFlagUtils.addRespondentDQPartiesFlagStructure;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_EXPERTS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_LITIGATION_FRIEND_ID;
Expand All @@ -75,8 +75,6 @@
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.mapUpdatePartyDetailsFormToDQExperts;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.mapUpdatePartyDetailsFormToDQWitnesses;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.mapWitnessesToUpdatePartyDetailsForm;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.updatePartyDQExperts;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.updatePartyDQWitnesses;
import static uk.gov.hmcts.reform.civil.utils.UserRoleUtils.isApplicantSolicitor;
import static uk.gov.hmcts.reform.civil.utils.UserRoleUtils.isRespondentSolicitorOne;
import static uk.gov.hmcts.reform.civil.utils.UserRoleUtils.isRespondentSolicitorTwo;
Expand Down Expand Up @@ -388,11 +386,8 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
List<Element<PartyFlagStructure>> updatedApplicantExperts = updatePartyDQExperts(
unwrapElements(caseData.getApplicantExperts()),
unwrapElements(mappedExperts)
);
builder.applicantExperts(updatedApplicantExperts);
addApplicantExpertAndWitnessFlagsStructure(builder, caseData);
//TODO: need to add it to top level party object
} else if (partyId.equals(DEFENDANT_ONE_EXPERTS_ID)) {
mappedExperts = mapUpdatePartyDetailsFormToDQExperts(
caseData.getRespondent1DQ().getRespondent1DQExperts().getDetails(), formData);
Expand All @@ -403,11 +398,8 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
List<Element<PartyFlagStructure>> updatedRespondent1Experts = updatePartyDQExperts(
unwrapElements(caseData.getRespondent1Experts()),
unwrapElements(mappedExperts)
);
builder.respondent1Experts(updatedRespondent1Experts);
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
} else if (partyId.equals(DEFENDANT_TWO_EXPERTS_ID)) {
mappedExperts = mapUpdatePartyDetailsFormToDQExperts(
caseData.getRespondent2DQ().getRespondent2DQExperts().getDetails(), formData);
Expand All @@ -418,11 +410,8 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
List<Element<PartyFlagStructure>> updatedRespondent2Experts = updatePartyDQExperts(
unwrapElements(caseData.getRespondent2Experts()),
unwrapElements(mappedExperts)
);
builder.respondent2Experts(updatedRespondent2Experts);
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
}

}
Expand All @@ -441,11 +430,8 @@ private void updateWitnesses(String partyId, CaseData caseData, CaseData.CaseDat
.details(mappedWitnesses)
.build())
.build());
List<Element<PartyFlagStructure>> updatedApplicantWitnesses = updatePartyDQWitnesses(
unwrapElements(caseData.getApplicantWitnesses()),
unwrapElements(mappedWitnesses)
);
builder.applicantWitnesses(updatedApplicantWitnesses);
addApplicantExpertAndWitnessFlagsStructure(builder, caseData);
//TODO: need to add it to top level party object
} else if (partyId.equals(DEFENDANT_ONE_WITNESSES_ID)) {
mappedWitnesses = mapUpdatePartyDetailsFormToDQWitnesses(
caseData.getRespondent1DQ().getRespondent1DQWitnesses().getDetails(), formData);
Expand All @@ -456,11 +442,8 @@ private void updateWitnesses(String partyId, CaseData caseData, CaseData.CaseDat
.details(mappedWitnesses)
.build())
.build());
List<Element<PartyFlagStructure>> updatedRespondent1Witnesses = updatePartyDQWitnesses(
unwrapElements(caseData.getRespondent1Witnesses()),
unwrapElements(mappedWitnesses)
);
builder.respondent1Witnesses(updatedRespondent1Witnesses);
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
} else if (partyId.equals(DEFENDANT_TWO_WITNESSES_ID)) {
mappedWitnesses = mapUpdatePartyDetailsFormToDQWitnesses(
caseData.getRespondent2DQ().getRespondent2DQWitnesses().getDetails(), formData);
Expand All @@ -471,11 +454,8 @@ private void updateWitnesses(String partyId, CaseData caseData, CaseData.CaseDat
.details(mappedWitnesses)
.build())
.build());
List<Element<PartyFlagStructure>> updatedRespondent2Witnesses = updatePartyDQWitnesses(
unwrapElements(caseData.getRespondent2Witnesses()),
unwrapElements(mappedWitnesses)
);
builder.respondent2Witnesses(updatedRespondent2Witnesses);
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.wrapElements;
import static uk.gov.hmcts.reform.civil.utils.ExpertUtils.addEventAndDateAddedToRespondentExperts;
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.populateDQPartyIds;
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.populateWithPartyIds;
import static uk.gov.hmcts.reform.civil.utils.WitnessUtils.addEventAndDateAddedToRespondentWitnesses;

@Service
Expand Down Expand Up @@ -1527,6 +1528,10 @@ && ifResponseTypeIsPartOrFullAdmission(caseData)) {
}
}

if (toggleService.isHmcEnabled()) {
populateWithPartyIds(updatedData);
}

updateCorrespondenceAddress(callbackParams, updatedData, caseData);

if (getMultiPartyScenario(caseData) == ONE_V_TWO_TWO_LEGAL_REP
Expand Down
62 changes: 14 additions & 48 deletions src/main/java/uk/gov/hmcts/reform/civil/utils/CaseFlagUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,21 @@
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.element;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.unwrapElements;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.wrapElements;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_EXPERTS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_LEGAL_REP_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_LITIGATION_FRIEND_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_ORG_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_ONE_WITNESSES_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_TWO_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_TWO_LITIGATION_FRIEND_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.CLAIMANT_TWO_ORG_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_EXPERTS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_LEGAL_REP_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_LITIGATION_FRIEND_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_ORG_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_ONE_WITNESSES_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_EXPERTS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_LEGAL_REP_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_LITIGATION_FRIEND_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_ORG_INDIVIDUALS_ID;
import static uk.gov.hmcts.reform.civil.utils.ManageContactInformationUtils.DEFENDANT_TWO_WITNESSES_ID;
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.appendWithNewPartyId;

import uk.gov.hmcts.reform.civil.model.LitigationFriend;
Expand All @@ -54,20 +48,20 @@

public class CaseFlagUtils {

public static final String RESPONDENT_SOLICITOR_ONE_WITNESS = "Defendant solicitor 1 witness";
public static final String RESPONDENT_SOLICITOR_ONE_EXPERT = "Defendant solicitor 1 expert";
public static final String RESPONDENT_SOLICITOR_TWO_WITNESS = "Defendant solicitor 2 witness";
public static final String RESPONDENT_SOLICITOR_TWO_EXPERT = "Defendant solicitor 2 expert";
public static final String APPLICANT_SOLICITOR_WITNESS = "Claimant solicitor witness";
public static final String APPLICANT_SOLICITOR_EXPERT = "Claimant solicitor expert";
public static final String APPLICANT_ONE = "Claimant 1";
public static final String APPLICANT_TWO = "Claimant 2";
public static final String APPLICANT_ONE_LITIGATION_FRIEND = "Claimant 1 Litigation Friend";
public static final String APPLICANT_TWO_LITIGATION_FRIEND = "Claimant 2 Litigation Friend";
public static final String RESPONDENT_ONE = "Defendant 1";
public static final String RESPONDENT_TWO = "Defendant 2";
public static final String RESPONDENT_ONE_LITIGATION_FRIEND = "Defendant 1 Litigation Friend";
public static final String RESPONDENT_TWO_LITIGATION_FRIEND = "Defendant 2 Litigation Friend";
public static final String RESPONDENT_SOLICITOR_ONE_WITNESS = "Respondent solicitor 1 witness";
public static final String RESPONDENT_SOLICITOR_ONE_EXPERT = "Respondent solicitor 1 expert";
public static final String RESPONDENT_SOLICITOR_TWO_WITNESS = "Respondent solicitor 2 witness";
public static final String RESPONDENT_SOLICITOR_TWO_EXPERT = "Respondent solicitor 2 expert";
public static final String APPLICANT_SOLICITOR_WITNESS = "Applicant solicitor witness";
public static final String APPLICANT_SOLICITOR_EXPERT = "Applicant solicitor expert";
public static final String APPLICANT_ONE = "Applicant 1";
public static final String APPLICANT_TWO = "Applicant 2";
public static final String APPLICANT_ONE_LITIGATION_FRIEND = "Applicant 1 Litigation Friend";
public static final String APPLICANT_TWO_LITIGATION_FRIEND = "Applicant 2 Litigation Friend";
public static final String RESPONDENT_ONE = "Respondent 1";
public static final String RESPONDENT_TWO = "Respondent 2";
public static final String RESPONDENT_ONE_LITIGATION_FRIEND = "Respondent 1 Litigation Friend";
public static final String RESPONDENT_TWO_LITIGATION_FRIEND = "Respondent 2 Litigation Friend";

private CaseFlagUtils() {
//NO-OP
Expand Down Expand Up @@ -215,10 +209,6 @@ public static void createOrUpdateFlags(CaseData.CaseDataBuilder<?, ?> builder, C
updateOrgIndividualsFlags(builder, caseData, partyChosen);
// attending for legal rep
updateLRIndividualsFlags(builder, caseData, partyChosen, organisationService);
// experts
updateExpertFlags(builder, caseData, partyChosen);
// witnesses
updateWitnessFlags(builder, caseData, partyChosen);
}

private static void updateLRIndividualsFlags(CaseData.CaseDataBuilder<?, ?> builder, CaseData caseData, String partyChosen, OrganisationService organisationService) {
Expand Down Expand Up @@ -275,30 +265,6 @@ private static void updateLitigationFriendFlags(CaseData.CaseDataBuilder<?, ?> b
}
}

private static void updateExpertFlags(CaseData.CaseDataBuilder<?, ?> builder, CaseData caseData, String partyChosen) {
if ((CLAIMANT_ONE_EXPERTS_ID).equals(partyChosen)) {
builder.applicantExperts(updatePartyNameForPartyFlagStructures(caseData.getApplicantExperts(), APPLICANT_SOLICITOR_EXPERT));
}
if ((DEFENDANT_ONE_EXPERTS_ID).equals(partyChosen)) {
builder.respondent1Experts(updatePartyNameForPartyFlagStructures(caseData.getRespondent1Experts(), RESPONDENT_SOLICITOR_ONE_EXPERT));
}
if ((DEFENDANT_TWO_EXPERTS_ID).equals(partyChosen)) {
builder.respondent2Experts(updatePartyNameForPartyFlagStructures(caseData.getRespondent2Experts(), RESPONDENT_SOLICITOR_TWO_EXPERT));
}
}

private static void updateWitnessFlags(CaseData.CaseDataBuilder<?, ?> builder, CaseData caseData, String partyChosen) {
if ((CLAIMANT_ONE_WITNESSES_ID).equals(partyChosen)) {
builder.applicantWitnesses(updatePartyNameForPartyFlagStructures(caseData.getApplicantWitnesses(), APPLICANT_SOLICITOR_WITNESS));
}
if ((DEFENDANT_ONE_WITNESSES_ID).equals(partyChosen)) {
builder.respondent1Witnesses(updatePartyNameForPartyFlagStructures(caseData.getRespondent1Witnesses(), RESPONDENT_SOLICITOR_ONE_WITNESS));
}
if ((DEFENDANT_TWO_WITNESSES_ID).equals(partyChosen)) {
builder.respondent2Witnesses(updatePartyNameForPartyFlagStructures(caseData.getRespondent2Witnesses(), RESPONDENT_SOLICITOR_TWO_WITNESS));
}
}

private static void updatePartyFlags(CaseData.CaseDataBuilder<?, ?> builder, CaseData caseData, String partyChosen) {
if ((CLAIMANT_ONE_ID).equals(partyChosen)) {
builder.applicant1(updatePartyNameForFlags(caseData.getApplicant1()));
Expand Down
Loading

0 comments on commit 7d4c833

Please sign in to comment.