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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ src/main/resources/application.yaml
/.aat-env
/bin/ccd-config-PRL-local.xlsx
/.mirrord/mirrord.json
/node_modules/.yarn-integrity
/node_modules/.yarn-state.yml
/.yarnrc.yml
/gradle-8.7-bin.zip
/.yarn/install-state.gz
/package.json
/yarn.lock
/.yarn/releases/yarn-4.12.0.cjs
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ apply plugin: 'net.serenity-bdd.aggregator'
group = 'uk.gov.hmcts.reform.prl'
version = '0.0.1'

mainClassName = 'uk.gov.hmcts.reform.prl.Application'
if (GradleVersion.current() >= GradleVersion.version('9.0')) {
springBoot {
mainClass.set('uk.gov.hmcts.reform.prl.Application')
}
} else {
mainClassName = 'uk.gov.hmcts.reform.prl.Application'
}

bootJar {
getArchiveFileName().set(provider {
Expand Down Expand Up @@ -467,7 +473,6 @@ dependencies {
integrationTestImplementation(sourceSets.test.output)
}


processContractTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,38 @@ public void givenValidDocumentData_then200Response() throws IOException {
.body("message", equalTo("Document has been uploaded successfully: Dummy_pdf_file.pdf"));

}

@Test
@Order(3)
public void givenCirTransferDocument_then200Response() throws IOException {
final File fileToUpload = readFile(CAFCASS_DUMMY_UPLOAD_FILE);

request
.header("Authorization", idamTokenGenerator.generateIdamTokenForCafcass())
.header("ServiceAuthorization", serviceAuthenticationGenerator.generateTokenForCcd())
.multiPart("file", fileToUpload)
.param("typeOfDocument", "cirTransferRequest")
.pathParam("caseId", caseDetails.getId())
.contentType(MediaType.MULTIPART_FORM_DATA_VALUE)
.post("/{caseId}/document")
.then().assertThat().statusCode(200)
.body("message", equalTo("Document has been uploaded successfully: Dummy_pdf_file.pdf"));
}

@Test
@Order(4)
public void givenCirExtensionDocument_then200Response() throws IOException {
final File fileToUpload = readFile(CAFCASS_DUMMY_UPLOAD_FILE);

request
.header("Authorization", idamTokenGenerator.generateIdamTokenForCafcass())
.header("ServiceAuthorization", serviceAuthenticationGenerator.generateTokenForCcd())
.multiPart("file", fileToUpload)
.param("typeOfDocument", "cirExtensionRequest")
.pathParam("caseId", caseDetails.getId())
.contentType(MediaType.MULTIPART_FORM_DATA_VALUE)
.post("/{caseId}/document")
.then().assertThat().statusCode(200)
.body("message", equalTo("Document has been uploaded successfully: Dummy_pdf_file.pdf"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public enum CafcassReportAndGuardianEnum {

riskAssessment("16aRiskAssessment", "16a risk assessment"),

cirTransferRequest("cirTransferRequest", "CIR Transfer Request"),

cirExtensionRequest("cirExtensionRequest", "CIR Extension Request"),

guardianReport("guardianReport", "Guardian report"),

specialGuardianshipReport("specialGuardianshipReport", "Special guardianship report"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.SEC37_REPORT;
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.SECTION7_REPORT;
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.SECTION_37_REPORT;
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.SIXTEEN_A_RISK_ASSESSMENT;
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.SPECIAL_GUARDIANSHIP_REPORT;
import static uk.gov.hmcts.reform.prl.constants.ManageDocumentsCategoryConstants.TRANSCRIPTS_OF_JUDGEMENTS;
import static uk.gov.hmcts.reform.prl.constants.PrlAppsConstants.BLANK_STRING;
Expand Down Expand Up @@ -605,13 +604,6 @@ private static void mapCafcassLaReports(QuarantineLegalDoc doc, HashMap<String,
.documentFileName(doc.getSection7ReportDocument().getDocumentFileName())
.documentGroup(BundlingDocGroupEnum.section7Report).build() : null
);
bundleMap.put(
SIXTEEN_A_RISK_ASSESSMENT,
Objects.nonNull(doc.getSixteenARiskAssessmentDocument()) ? BundlingRequestDocument.builder()
.documentLink(doc.getSixteenARiskAssessmentDocument())
.documentFileName(doc.getSixteenARiskAssessmentDocument().getDocumentFileName())
.documentGroup(BundlingDocGroupEnum.sixteenARiskAssessment).build() : null
);
bundleMap.put(
GUARDIAN_REPORT,
Objects.nonNull(doc.getGuardianReportDocument()) ? BundlingRequestDocument.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class QuarantineLegalDoc {
private final Document section7ReportDocument;
private final Document section37ReportDocument;
private final Document sixteenARiskAssessmentDocument; // 16aRiskAssessment
private final Document cirTransferRequestDocument;
private final Document cirExtensionRequestDocument;
private final Document guardianReportDocument;
private final Document specialGuardianshipReportDocument;
private final Document otherDocsDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@
public class CafcassUploadDocService {

public static final List<String> ALLOWED_FILE_TYPES = List.of("pdf", "docx");

static final String DOC_TYPE_CIR_TRANSFER = "cirTransferRequest";
static final String DOC_TYPE_CIR_EXTENSION = "cirExtensionRequest";
static final String DOC_TYPE_S16A_RISK_ASSESSMENT = "16aRiskAssessment";

public static final List<String> URGENT_CAFCASS_DOC_TYPES = List.of(
DOC_TYPE_CIR_TRANSFER, DOC_TYPE_CIR_EXTENSION, DOC_TYPE_S16A_RISK_ASSESSMENT
);
public static final String MANAGE_DOC_UPLOADED_CATEGORY = "manageDocUploadedCategory";

public static final List<String> ALLOWED_TYPE_OF_DOCS = List.of(
"16_4_Report", "CR_1", "CR_2", "CIR_Part1", "CIR_Part2", "CIR_Review", "CMO_report",
"16_4_Report", "CR_1", "CR_2", "CIR_Part1", "CIR_Part2", "CIR_Review",
DOC_TYPE_CIR_TRANSFER, DOC_TYPE_CIR_EXTENSION,
"CMO_report",
"Contact_Centre_Recordings", "Correspondence", "Direct_work", "Enforcement_report",
"FAO_Report", "FAO_Workplan", "Letter_from_Child", "Other_Non_Section_7_Report",
"Position_Statement", "Positive_Parenting_Programme_Report", "Re_W_Report",
"S_11H_Monitoring", "S_16A_Risk_Assessment", "Safeguarding_Letter",
"S_11H_Monitoring", DOC_TYPE_S16A_RISK_ASSESSMENT, "Safeguarding_Letter",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep String names as was before

"Safeguarding_Letter_Returner", "Safeguarding_Letter_Shorter_Template",
"Safeguarding_Letter_Update", "Second_Gatekeeping_Safeguarding_Letter",
"Section7_Addendum_Report", "Section7_Report_Child_Impact_Analysis", "Suitability_report"
Expand Down Expand Up @@ -107,6 +119,10 @@ private void updateCcdAfterUploadingDocument(MultipartFile document, String type

caseDataUpdated.putIfAbsent(MANAGE_DOCUMENTS_TRIGGERED_BY, null);

if (URGENT_CAFCASS_DOC_TYPES.contains(typeOfDocument)) {
caseDataUpdated.put(MANAGE_DOC_UPLOADED_CATEGORY, typeOfDocument);
}

manageDocumentsService.moveDocumentsToQuarantineTab(
quarantineLegalDoc,
startAllTabsUpdateDataContent.caseData(),
Expand Down Expand Up @@ -190,6 +206,8 @@ private static Map<String, CafcassReportAndGuardianEnum> createDocumentTypeMap()
map.put("CIR_Part1", CafcassReportAndGuardianEnum.section7Report);
map.put("CIR_Part2", CafcassReportAndGuardianEnum.section7Report);
map.put("CIR_Review", CafcassReportAndGuardianEnum.section7Report);
map.put(DOC_TYPE_CIR_TRANSFER, CafcassReportAndGuardianEnum.cirTransferRequest);
map.put(DOC_TYPE_CIR_EXTENSION, CafcassReportAndGuardianEnum.cirExtensionRequest);
map.put("CMO_report", CafcassReportAndGuardianEnum.otherDocs);
map.put("Contact_Centre_Recordings", CafcassReportAndGuardianEnum.otherDocs);
map.put("Correspondence", CafcassReportAndGuardianEnum.otherDocs);
Expand All @@ -203,7 +221,7 @@ private static Map<String, CafcassReportAndGuardianEnum> createDocumentTypeMap()
map.put("Positive_Parenting_Programme_Report", CafcassReportAndGuardianEnum.otherDocs);
map.put("Re_W_Report", CafcassReportAndGuardianEnum.otherDocs);
map.put("S_11H_Monitoring", CafcassReportAndGuardianEnum.otherDocs);
map.put("S_16A_Risk_Assessment", CafcassReportAndGuardianEnum.riskAssessment);
map.put(DOC_TYPE_S16A_RISK_ASSESSMENT, CafcassReportAndGuardianEnum.riskAssessment);
map.put("Safeguarding_Letter", CafcassReportAndGuardianEnum.safeguardingLetter);
map.put("Safeguarding_Letter_Returner", CafcassReportAndGuardianEnum.safeguardingLetter);
map.put("Safeguarding_Letter_Shorter_Template", CafcassReportAndGuardianEnum.safeguardingLetter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,16 +553,26 @@ public void testBundleCreateRequestMapper() {
.documentParty("Cafcass Cymru").categoryName(SAFEGUARDING_LETTER).categoryId("safeguardingLetter").build();
cafcassDoc.add(element(safeGuardingLetter));

QuarantineLegalDoc sixteenARiskAssessment = QuarantineLegalDoc.builder()
.sixteenARiskAssessmentDocument(Document.builder().documentFileName("16ARiskAssessment").build())
.documentParty("Cafcass").categoryName(SIXTEENA_RISK_ASSESSMENT).categoryId("16aRiskAssessment").build();
cafcassDoc.add(element(sixteenARiskAssessment));

QuarantineLegalDoc cirTransferRequest = QuarantineLegalDoc.builder()
.cirTransferRequestDocument(Document.builder().documentFileName("cirTransferRequest").build())
.documentParty("Cafcass").categoryId("cirTransferRequest").build();
cafcassDoc.add(element(cirTransferRequest));

QuarantineLegalDoc cirExtensionRequest = QuarantineLegalDoc.builder()
.cirExtensionRequestDocument(Document.builder().documentFileName("cirExtensionRequest").build())
.documentParty("Cafcass").categoryId("cirExtensionRequest").build();
cafcassDoc.add(element(cirExtensionRequest));

QuarantineLegalDoc section7Report = QuarantineLegalDoc.builder()
.section7ReportDocument(Document.builder().documentFileName("section7Report").build())
.documentParty("Cafcass Cymru").categoryName(SECTION_7_REPORT).categoryId("section7Report").build();
courtStaffDoc.add(element(section7Report));

QuarantineLegalDoc sixteenARiskAssessment = QuarantineLegalDoc.builder()
.sixteenARiskAssessmentDocument(Document.builder().documentFileName("16ARiskAssessment").build())
.documentParty("Cafcass Cymru").categoryName(SIXTEENA_RISK_ASSESSMENT).categoryId("16aRiskAssessment").build();
courtStaffDoc.add(element(sixteenARiskAssessment));

QuarantineLegalDoc guardianReport = QuarantineLegalDoc.builder()
.guardianReportDocument(Document.builder().documentFileName("guardianReport").build())
.documentParty("Cafcass Cymru").categoryName(GUARDIAN_REPORT).categoryId("guardianReport").build();
Expand Down Expand Up @@ -678,11 +688,13 @@ public void testBundleCreateRequestMapper() {
BundleCreateRequest bundleCreateRequest = bundleCreateRequestMapper.mapCaseDataToBundleCreateRequest(c100CaseData,"eventI",
Hearings.hearingsWith().build(),"sample.yaml");
assertNotNull(bundleCreateRequest);
// Should not contain police disclosures or medical records
// Should not contain police disclosures, medical records, anyOtherDocuments, 16A risk assessments,
// CIR Transfer Requests, or CIR Extension Requests (AC6)
assertThat(bundleCreateRequest.getCaseDetails().getCaseData().getData().getAllOtherDocuments().stream()
.map(Element::getValue)
.map(BundlingRequestDocument::getDocumentFileName)
.filter(fileName -> List.of("policeDisclosures", "medicalRecords", "anyOtherDocuments")
.filter(fileName -> List.of("policeDisclosures", "medicalRecords", "anyOtherDocuments",
"16ARiskAssessment", "cirTransferRequest", "cirExtensionRequest")
.contains(fileName)).toList())
.asInstanceOf(LIST).isEmpty();
}
Expand Down
Loading