Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
ef9cb77
Implement Enforcement Writ feature including entity, repository, DB s…
tvr-solirius Feb 17, 2026
98519d5
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 18, 2026
f54d87e
Remove `showChangeNameAddressPage` field from WritDetailsMapper, Enfo…
tvr-solirius Feb 18, 2026
e499ad3
Refactor `loadTestPcsCase` method to enhance readability and utilize …
tvr-solirius Feb 18, 2026
2b60e2e
Rename `EnforcementWritEntity` and `EnforcementWritRepository` to `Wr…
tvr-solirius Feb 19, 2026
df30ae6
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 19, 2026
57c9b6b
Introduce `EnforcementTypeStrategy` framework and refactor `Enforceme…
tvr-solirius Feb 19, 2026
971d25d
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 19, 2026
b452e1d
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 20, 2026
5be1666
Rename `EnforcementRiskProfileEntity` to `RiskProfileEntity` across t…
tvr-solirius Feb 20, 2026
c41cb90
Move `warrant` repositories into `enforcetheorder` package and update…
tvr-solirius Feb 23, 2026
a0fdeab
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 23, 2026
d877cd9
Map YesOrNo and VerticalYesNo fields in WritDetailsMapper with conver…
tvr-solirius Feb 23, 2026
88501e5
Rename `testcasegeneration` directory to `test-case-generation` and u…
tvr-solirius Feb 23, 2026
c8619ae
Merge branch 'master' into HDPI-Enforcement-Writ-Details
tvr-hmcts Feb 23, 2026
bb28f56
Delete obsolete `Create-Enforcement-Writ-Basic-Case.json` test resour…
tvr-solirius Feb 23, 2026
fc5de9a
Add `Create-Enforcement-Writ-Basic-Case.json` test file and update fi…
tvr-solirius Feb 23, 2026
0febeec
Add logging for `listItems` and `dynamicList` creation in `TestCaseSu…
tvr-solirius Feb 24, 2026
361a1e2
Remove redundant `isFile` checks in `TestCaseSupportHelperTest` to cl…
tvr-solirius Feb 24, 2026
08d650e
Update `testcasegeneration` directory references to `test-case-genera…
tvr-solirius Feb 24, 2026
b506a92
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 24, 2026
fa10657
Refactor `mapper` package structure and rename classes for consistenc…
tvr-solirius Feb 25, 2026
1289079
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 25, 2026
48d2f34
Remove `EnforcementWarrantMapper` and associated test classes as they…
tvr-solirius Feb 25, 2026
ef42f49
Merge branch 'refs/heads/master' into HDPI-Enforcement-Writ-Details
tvr-solirius Feb 26, 2026
14cac61
Applying the same strategy approach to the WritOfRestritution.
tvr-solirius Feb 27, 2026
ad60248
Realigning with master and refactoring for the warrant of restitution…
tvr-solirius Feb 27, 2026
478d7cc
Updating for the addition of the warrant of restitution strategy
tvr-solirius Feb 27, 2026
a1e3023
Applying back tests at the new location.
tvr-solirius Feb 27, 2026
a7fe612
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Feb 27, 2026
20ff25e
Merge branch 'master' into HDPI-Enforcement-Writ-Details
cristianemarsilio Mar 2, 2026
ee99bfe
Upgrade enforcement writ details migration to V061.
tvr-solirius Mar 2, 2026
1f5abcd
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Mar 2, 2026
49dc87f
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-E…
tvr-solirius Mar 2, 2026
dfda175
Upgrade enforcement writ details migration to V062.
tvr-solirius Mar 2, 2026
118fbc9
WIP - Add language_used, show_change_name_address_page and other UI f…
tvr-solirius Mar 4, 2026
0198afc
Add submission_date to enforcement tables, add language_used and show…
tvr-solirius Mar 4, 2026
5334dde
Drop obsolete `showPeopleWhoWillBeEvictedPage` field from the Writ mo…
tvr-solirius Mar 5, 2026
1d751ab
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 5, 2026
3fc6c71
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 6, 2026
09e0034
Add submission dates and language selection to enforcement entities, …
tvr-solirius Mar 6, 2026
5181b0b
Additional tests and some minor alterations.
tvr-solirius Mar 6, 2026
5d79c12
Altered to take on as a timestamp now the submissionDate becomes crea…
tvr-solirius Mar 6, 2026
b3cbbd4
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 6, 2026
24255b3
Drop some indexes that are not needed.
tvr-solirius Mar 6, 2026
1c2f9fa
With IF EXISTS
tvr-solirius Mar 6, 2026
e084d85
Added another redundant index.
tvr-solirius Mar 6, 2026
5f17040
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 9, 2026
977944f
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 9, 2026
6759517
Drop unused enforcement indexes from the database migration.
tvr-solirius Mar 9, 2026
04aa2b4
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 10, 2026
b6e1dab
Remove unused showChangeNameAddressPage column and field from Warrant…
tvr-solirius Mar 13, 2026
76580b5
Merge branch 'refs/heads/master' into HDPI-4220-Update-Enforcement-Da…
tvr-solirius Mar 13, 2026
e0a4fc3
Remove unused statement‑of‑truth fields from `WritEntity` and clean u…
tvr-solirius Mar 15, 2026
543fb03
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 16, 2026
189fc43
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 17, 2026
d93595a
Changed numbering to V065 enforcement data model migration
tvr-solirius Mar 17, 2026
a0fd815
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 17, 2026
5221e3b
Changed numbering to V067 enforcement data model migration
tvr-solirius Mar 17, 2026
d078030
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 19, 2026
d66ac56
Changed numbering to V070 enforcement data model migration
tvr-solirius Mar 19, 2026
544bc25
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 19, 2026
1ce457b
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 20, 2026
e02b818
HDPI-5188 - Initial changes for Warrant of Restitution - Update data …
guygrewal77 Mar 20, 2026
868aff8
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 20, 2026
11b4859
HDPI-5188 - Unit test fixes
guygrewal77 Mar 20, 2026
6144ab2
Merge branch 'HDPI-4220-Update-Enforcement-Data-Model' into HDPI-5188…
guygrewal77 Mar 20, 2026
e9994ba
HDPI-5188 - unit test fixes
guygrewal77 Mar 20, 2026
e1f2468
Add default `CURRENT_TIMESTAMP` to the `created` columns in the enfor…
tvr-solirius Mar 23, 2026
61bad23
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 23, 2026
af6cee2
HDPI-5188 - static imports
guygrewal77 Mar 23, 2026
b5beae8
Merge branch 'HDPI-4220-Update-Enforcement-Data-Model' into HDPI-5188…
guygrewal77 Mar 23, 2026
ebe6938
HDPI-5188 - Remove check for null Statement of Truth which is expecte…
guygrewal77 Mar 24, 2026
667345e
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 24, 2026
9ff96f8
HDPI-5188 - Added unit test for new util method
guygrewal77 Mar 25, 2026
fb15dd6
HDPI-5188 - Mappers refactored and improved code coverage
guygrewal77 Mar 26, 2026
bf1ae1b
HDPI-5188 - Mapper and unit test changes
guygrewal77 Mar 26, 2026
96e4e0a
HDPI-5188 - Removed unnecessary tests
guygrewal77 Mar 26, 2026
ed42b6f
HDPI-5188 - Removed Evict everyone and changed placeholder to next pa…
guygrewal77 Mar 26, 2026
20d27b1
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 26, 2026
856c8c6
HDPI-5188 - Bumped up migration script number
guygrewal77 Mar 26, 2026
9b7bfe9
HDPI-5188 - Implemented service class for Warrant of Restitution Docu…
guygrewal77 Mar 26, 2026
5756d42
HDPI-5188 - Removed domain fields and mappers for pages not implement…
guygrewal77 Mar 27, 2026
35a90f0
HDPI-5188 - Removed changes not required
guygrewal77 Mar 27, 2026
edcd5f5
HDPI-5188 - Formatting changes removed
guygrewal77 Mar 27, 2026
25cfd6a
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 27, 2026
2381765
HDPI-5188 - Changes not needed removed
guygrewal77 Mar 27, 2026
7ec3e75
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 27, 2026
7663a32
Merge branch 'master' into HDPI-5188-warrant-of-rest-update-data-model
guygrewal77 Mar 30, 2026
7d4067a
HDPI-5188 - Flyway script number updated
guygrewal77 Mar 30, 2026
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 @@ -24,6 +24,7 @@ public enum DocumentType implements HasLabel {
INSPECTION_OR_REPORT("Inspection or report"),
CERTIFICATE_OF_SUITABILITY_AS_LF("Certificate of suitability as litigation friend"),
LEGAL_AID_CERTIFICATE("Legal aid certificate"),
POLICE_REPORT("Police report"),
OTHER("Other document");

private final String label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ public class WarrantOfRestitutionDetails {
@JsonUnwrapped
@CCD
private AdditionalInformation additionalInformation;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import uk.gov.hmcts.reform.pcs.ccd.domain.DocumentType;
import uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder.EnforcementOrderEntity;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -58,4 +59,9 @@ public class DocumentEntity {
@Builder.Default
@JsonManagedReference
private List<ClaimDocumentEntity> claimDocuments = new ArrayList<>();

@ManyToOne(fetch = LAZY)
@JoinColumn(name = "enf_case_id")
@JsonBackReference
private EnforcementOrderEntity enfCase;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.hmcts.reform.pcs.ccd.entity.claim;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
Expand All @@ -19,6 +20,7 @@
import uk.gov.hmcts.ccd.sdk.type.YesOrNo;
import uk.gov.hmcts.reform.pcs.ccd.domain.statementoftruth.StatementOfTruthCompletedBy;
import uk.gov.hmcts.reform.pcs.ccd.entity.ClaimEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder.EnforcementOrderEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.respondpossessionclaim.DefendantResponseEntity;

import java.util.UUID;
Expand All @@ -44,6 +46,10 @@ public class StatementOfTruthEntity {
@JsonBackReference
private DefendantResponseEntity defendantResponse;

@OneToOne(mappedBy = "statementOfTruth")
@JsonManagedReference
private EnforcementOrderEntity enforcementOrder;

@Enumerated(EnumType.STRING)
private StatementOfTruthCompletedBy completedBy;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
package uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcetheorder.EnforcementOrder;
import uk.gov.hmcts.reform.pcs.ccd.entity.ClaimEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.DocumentEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.claim.StatementOfTruthEntity;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import static jakarta.persistence.CascadeType.ALL;
import static jakarta.persistence.FetchType.LAZY;

@Entity
@Table(name = "enf_case")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EnforcementOrderEntity {

@Id
Expand All @@ -40,7 +53,26 @@ public class EnforcementOrderEntity {
@Column(name = "enforcement_order")
private EnforcementOrder enforcementOrder;

@OneToOne(mappedBy = "enforcementOrder", fetch = LAZY)
@OneToOne(mappedBy = "enforcementOrder")
private WarrantEntity warrantDetails;

@OneToOne(mappedBy = "enforcementOrder")
private WarrantOfRestitutionEntity warrantOfRestitutionDetails;

@OneToOne(fetch = LAZY)
@JoinColumn(name = "sot_id", nullable = false)
@JsonBackReference
private StatementOfTruthEntity statementOfTruth;

@OneToMany(mappedBy = "enfCase", fetch = LAZY, cascade = ALL, orphanRemoval = true)
@Builder.Default
@JsonManagedReference
private List<DocumentEntity> documents = new ArrayList<>();

public void addDocuments(List<DocumentEntity> documents) {
for (DocumentEntity document : documents) {
document.setEnfCase(this);
this.documents.add(document);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,27 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import uk.gov.hmcts.reform.pcs.ccd.domain.LanguageUsed;
import uk.gov.hmcts.reform.pcs.ccd.domain.VerticalYesNo;

import java.time.Instant;
import java.util.UUID;

@Entity
@Builder
@Table(name = "enf_warrant_of_restitution")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class WarrantOfRestitutionEntity {

@Id
Expand All @@ -34,6 +43,23 @@ public class WarrantOfRestitutionEntity {
@JsonBackReference
private EnforcementOrderEntity enforcementOrder;

// Defendants Returned
private String howDefendantsReturned;

// Additional Information
@Enumerated(EnumType.STRING)
@JdbcTypeCode(SqlTypes.NAMED_ENUM)
private VerticalYesNo additionalInformationSelect;

private String additionalInformationDetails;

// PropertyAccessDetails
@Enumerated(EnumType.STRING)
@JdbcTypeCode(SqlTypes.NAMED_ENUM)
private VerticalYesNo isDifficultToAccessProperty;

private String clarificationOnAccessDifficultyText;

@Enumerated(EnumType.STRING)
private LanguageUsed languageUsed;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import static uk.gov.hmcts.reform.pcs.ccd.page.CommonPageContent.SAVE_AND_RETURN;
import static uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.ShowConditionsEnforcementType.WARRANT_OF_RESTITUTION_FLOW;

public class PropertyAccessDetailsWarrantRestPlaceholder implements CcdPageConfiguration {
public class PeopleYouWantToEvictWarrantRestPlaceholder implements CcdPageConfiguration {

@Override
public void addTo(PageBuilder pageBuilder) {
pageBuilder
.page("propertyAccessDetailsRest")
.pageLabel("Access to the property (Placeholder)")
.page("peopleYouWantToEvictWarrantRest")
.pageLabel("The people you want to evict (placeholder)")
.showCondition(WARRANT_OF_RESTITUTION_FLOW)
.label("propertyAccessDetailsRest-line-separator", "---")
.label("propertyAccessDetailsRest-saveAndReturn", SAVE_AND_RETURN);
.label("peopleYouWantToEvictWarrantRest-line-separator", "---")
.label("peopleYouWantToEvictWarrantRest-save-and-return", SAVE_AND_RETURN);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WarrantOfRestitutionPageConfigurer implements PageConfigurer {
@Override
public void configurePages(PageBuilder pageBuilder) {
pageBuilder
.add(new PeopleWhoWillBeEvictedWarrantRestPlaceholder())
.add(new PeopleYouWantToEvictWarrantRestPlaceholder())
.add(new ShareEvidenceWithJudgePage())
.add(explainHowDefendantsReturnedPage)
.add(new DefendantAtPropertyPage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import uk.gov.hmcts.ccd.sdk.type.Document;
import uk.gov.hmcts.ccd.sdk.type.ListValue;
import uk.gov.hmcts.reform.pcs.ccd.domain.AdditionalDocument;
Expand All @@ -12,6 +13,9 @@
import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase;
import uk.gov.hmcts.reform.pcs.ccd.domain.RentArrearsSection;
import uk.gov.hmcts.reform.pcs.ccd.domain.TenancyLicenceDetails;
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcetheorder.EnforcementOrder;
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcetheorder.warrantofrestitution.EvidenceDocumentType;
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcetheorder.warrantofrestitution.EvidenceOfDefendants;
import uk.gov.hmcts.reform.pcs.ccd.domain.wales.OccupationLicenceDetailsWales;
import uk.gov.hmcts.reform.pcs.ccd.entity.DocumentEntity;
import uk.gov.hmcts.reform.pcs.ccd.repository.DocumentRepository;
Expand All @@ -31,37 +35,56 @@ public class DocumentService {

public List<DocumentEntity> createAllDocuments(PCSCase pcsCase) {

List<Pair<Document, DocumentType>> allDocuments = getPcsCaseDocuments(pcsCase);

return documentRepository.saveAll(createDocumentEntities(allDocuments));
}

public List<DocumentEntity> createAllDocuments(EnforcementOrder enforcementOrder) {

List<Pair<Document, DocumentType>> allDocuments = getWarrantOfRestitutionDocuments(enforcementOrder);

return documentRepository.saveAll(createDocumentEntities(allDocuments));
}

private List<Pair<Document, DocumentType>> getPcsCaseDocuments(PCSCase pcsCase) {
List<Pair<Document, DocumentType>> allDocuments = new ArrayList<>();

allDocuments.addAll(mapAdditionalDocumentsWithType(pcsCase.getAdditionalDocuments()));

allDocuments.addAll(mapDocumentsWithType(
Optional.ofNullable(pcsCase.getRentArrears())
.map(RentArrearsSection::getStatementDocuments)
.orElse(null), DocumentType.RENT_STATEMENT));
.map(RentArrearsSection::getStatementDocuments)
.orElse(null), DocumentType.RENT_STATEMENT));

allDocuments.addAll(mapDocumentsWithType(
Optional.ofNullable(pcsCase.getTenancyLicenceDetails())
.map(TenancyLicenceDetails::getTenancyLicenceDocuments)
.orElse(null), DocumentType.TENANCY_LICENCE));
.map(TenancyLicenceDetails::getTenancyLicenceDocuments)
.orElse(null), DocumentType.TENANCY_LICENCE));

allDocuments.addAll(mapDocumentsWithType(
Optional.ofNullable(pcsCase.getOccupationLicenceDetailsWales())
.map(OccupationLicenceDetailsWales::getLicenceDocuments)
.orElse(null), DocumentType.OCCUPATION_LICENCE));
.map(OccupationLicenceDetailsWales::getLicenceDocuments)
.orElse(null), DocumentType.OCCUPATION_LICENCE));

allDocuments.addAll(mapDocumentsWithType(
Optional.ofNullable(pcsCase.getNoticeServedDetails())
.map(NoticeServedDetails::getNoticeDocuments)
.orElse(null), DocumentType.NOTICE_SERVED));
.map(NoticeServedDetails::getNoticeDocuments)
.orElse(null), DocumentType.NOTICE_SERVED));

return documentRepository.saveAll(createDocumentEntities(allDocuments));
return allDocuments;
}

private List<Pair<Document, DocumentType>> getWarrantOfRestitutionDocuments(EnforcementOrder enforcementOrder) {

return new ArrayList<>(mapEvidenceOfDefendantsDocumentsWithType(
enforcementOrder.getWarrantOfRestitutionDetails().getAdditionalDocuments()));
}

private List<Pair<Document, DocumentType>> mapDocumentsWithType(
List<ListValue<Document>> docs, DocumentType type) {

if (docs == null || docs.isEmpty()) {
if (CollectionUtils.isEmpty(docs)) {
return Collections.emptyList();
}

Expand All @@ -75,7 +98,7 @@ private List<Pair<Document, DocumentType>> mapDocumentsWithType(
private List<Pair<Document, DocumentType>> mapAdditionalDocumentsWithType(
List<ListValue<AdditionalDocument>> documents) {

if (documents == null || documents.isEmpty()) {
if (CollectionUtils.isEmpty(documents)) {
return Collections.emptyList();
}

Expand All @@ -87,10 +110,25 @@ private List<Pair<Document, DocumentType>> mapAdditionalDocumentsWithType(
.toList();
}

private List<Pair<Document, DocumentType>> mapEvidenceOfDefendantsDocumentsWithType(
List<ListValue<EvidenceOfDefendants>> documents) {

if (CollectionUtils.isEmpty(documents)) {
return Collections.emptyList();
}

return ListValueUtils.unwrapListItems(documents).stream()
.map(doc -> Pair.of(
doc.getDocument(),
mapEvidenceDocumentTypeToDocumentType(doc.getDocumentType())
))
.toList();
}

private List<DocumentEntity> createDocumentEntities(
List<Pair<Document, DocumentType>> documents) {

if (documents == null || documents.isEmpty()) {
if (CollectionUtils.isEmpty(documents)) {
return List.of();
}

Expand Down Expand Up @@ -122,4 +160,13 @@ private DocumentType mapAdditionalDocumentTypeToDocumentType(AdditionalDocumentT
case OTHER -> DocumentType.OTHER;
};
}

private DocumentType mapEvidenceDocumentTypeToDocumentType(EvidenceDocumentType evidenceDocumentType) {
return switch (evidenceDocumentType) {
case PHOTOGRAPHIC_EVIDENCE -> DocumentType.PHOTOGRAPHIC_EVIDENCE;
case POLICE_REPORT -> DocumentType.POLICE_REPORT;
case WITNESS_STATEMENT -> DocumentType.WITNESS_STATEMENT;
case OTHER -> DocumentType.OTHER;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ private static boolean legalRepAgreed(StatementOfTruthDetails statementOfTruth)
.orElse(false);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ private void createEnforcementOrder(long caseReference, EnforcementOrder enforce

ClaimEntity claimEntity = retrieveClaimEntity(pcsCaseEntity);

EnforcementOrderEntity orderEntity = enforcementOrderRepository
EnforcementOrderEntity savedEntity = enforcementOrderRepository
.save(mapToEntity(enforcementOrder, claimEntity));
strategyFactory.getStrategy(SelectEnforcementType.getSelectEnforcementTypeFromName(
enforcementOrder.getChooseEnforcementType().getValueCode()))
.process(orderEntity, enforcementOrder);
.process(savedEntity, enforcementOrder);
}

private EnforcementOrderEntity mapToEntity(EnforcementOrder enforcementOrder, ClaimEntity claimEntity) {
Expand All @@ -77,5 +77,4 @@ private EnforcementOrderEntity mapToEntity(EnforcementOrder enforcementOrder, Cl
enforcementOrderEntity.setEnforcementOrder(enforcementOrder);
return enforcementOrderEntity;
}

}
Loading
Loading