Skip to content

Commit

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

* Revert "Revert "CIV-10382 Case flags updates for new experts/witnesses (#3296)" (#3591)"
This reverts commit 7d4c833.
* point to ccd changes
---------

Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2023
1 parent 2f921e0 commit d840a91
Show file tree
Hide file tree
Showing 13 changed files with 618 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import uk.gov.hmcts.contino.GithubAPI
def type = "java"
def product = "civil"
def component = "service"
def ccdBranch = "master"
def ccdBranch = "revert-3591-revert-3279-feat/civ-10382"
def camundaBranch = "master"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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 @@ -49,10 +50,9 @@
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.CaseFlagUtils.addApplicantExpertAndWitnessFlagsStructure;
import static uk.gov.hmcts.reform.civil.utils.CaseFlagUtils.addRespondentDQPartiesFlagStructure;
import static uk.gov.hmcts.reform.civil.utils.CaseNameUtils.buildCaseNameInternal;
import static uk.gov.hmcts.reform.civil.utils.CaseNameUtils.buildCaseNamePublic;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.unwrapElements;
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 @@ -77,6 +77,8 @@
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 @@ -395,8 +397,11 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
addApplicantExpertAndWitnessFlagsStructure(builder, caseData);
//TODO: need to add it to top level party object
List<Element<PartyFlagStructure>> updatedApplicantExperts = updatePartyDQExperts(
unwrapElements(caseData.getApplicantExperts()),
unwrapElements(mappedExperts)
);
builder.applicantExperts(updatedApplicantExperts);
} else if (partyId.equals(DEFENDANT_ONE_EXPERTS_ID)) {
mappedExperts = mapUpdatePartyDetailsFormToDQExperts(
caseData.getRespondent1DQ().getRespondent1DQExperts().getDetails(), formData);
Expand All @@ -407,8 +412,11 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
List<Element<PartyFlagStructure>> updatedRespondent1Experts = updatePartyDQExperts(
unwrapElements(caseData.getRespondent1Experts()),
unwrapElements(mappedExperts)
);
builder.respondent1Experts(updatedRespondent1Experts);
} else if (partyId.equals(DEFENDANT_TWO_EXPERTS_ID)) {
mappedExperts = mapUpdatePartyDetailsFormToDQExperts(
caseData.getRespondent2DQ().getRespondent2DQExperts().getDetails(), formData);
Expand All @@ -419,8 +427,11 @@ private void updateExperts(String partyId, CaseData caseData, CaseData.CaseDataB
.details(mappedExperts)
.build())
.build());
addRespondentDQPartiesFlagStructure(builder, caseData);
//TODO: need to add it to top level party object
List<Element<PartyFlagStructure>> updatedRespondent2Experts = updatePartyDQExperts(
unwrapElements(caseData.getRespondent2Experts()),
unwrapElements(mappedExperts)
);
builder.respondent2Experts(updatedRespondent2Experts);
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
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 @@ -1528,10 +1527,6 @@ && ifResponseTypeIsPartOrFullAdmission(caseData)) {
}
}

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

updateCorrespondenceAddress(callbackParams, updatedData, caseData);

if (getMultiPartyScenario(caseData) == ONE_V_TWO_TWO_LEGAL_REP
Expand Down
62 changes: 48 additions & 14 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,21 +24,27 @@
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 @@ -48,20 +54,20 @@

public class CaseFlagUtils {

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";
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";

private CaseFlagUtils() {
//NO-OP
Expand Down Expand Up @@ -209,6 +215,10 @@ 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 @@ -265,6 +275,30 @@ 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 d840a91

Please sign in to comment.