Skip to content
Merged
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: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>uk.gov.moj.cpp.progression</groupId>
<artifactId>progression-parent</artifactId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Progression services application</name>
Expand Down Expand Up @@ -65,13 +65,13 @@
<material.version>17.0.72</material.version>
<json-transformer.version>1.0.6</json-transformer.version>
<access.control.version>6.4.1</access.control.version>
<referencedata.version>17.0.120</referencedata.version>
<referencedata.version>17.103.124</referencedata.version>
<listing.version>17.0.125</listing.version>
<hearing.version>17.0.134</hearing.version>
<hearing.version>17.0.144</hearing.version>
<usersgroups.version>17.0.37</usersgroups.version>
<defence.version>17.0.85</defence.version>
<referencedata.offence.version>17.0.38</referencedata.offence.version>
<coredomain.version>17.103.10</coredomain.version>
<coredomain.version>17.103.11</coredomain.version>
<directionsmanagement.version>8.0.30</directionsmanagement.version>
<elasticsearch-maven-plugin.version>6.13</elasticsearch-maven-plugin.version>
<results.version>17.0.87</results.version>
Expand Down
2 changes: 1 addition & 1 deletion progression-command/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.progression</groupId>
<artifactId>progression-parent</artifactId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<artifactId>progression-command</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion progression-command/progression-command-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.progression</groupId>
<artifactId>progression-command</artifactId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<artifactId>progression-command-api</artifactId>
<packaging>war</packaging>
Expand Down
2 changes: 1 addition & 1 deletion progression-command/progression-command-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.progression</groupId>
<artifactId>progression-command</artifactId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<artifactId>progression-command-handler</artifactId>
<packaging>war</packaging>
Expand Down
2 changes: 1 addition & 1 deletion progression-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.gov.moj.cpp.progression</groupId>
<artifactId>progression-parent</artifactId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<artifactId>progression-domain</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion progression-domain/progression-datatypes-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>progression-domain</artifactId>
<groupId>uk.gov.moj.cpp.progression</groupId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion progression-domain/progression-domain-aggregate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>progression-domain</artifactId>
<groupId>uk.gov.moj.cpp.progression</groupId>
<version>17.0.225-CCPAP-519-SNAPSHOT</version>
<version>17.0.228-CCPAP-519-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>progression-domain-aggregate</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,18 +616,26 @@ private void handleProsecutionCaseOffencesUpdated(final ProsecutionCaseOffencesU
final Set<uk.gov.justice.core.courts.Offence> offenceSet = new TreeSet<>((o1, o2) -> o1.getId().compareTo(o2.getId()));
offenceSet.addAll(prosecutionCaseOffencesUpdated.getDefendantCaseOffences().getOffences());
offenceSet.addAll(defendant.getOffences());
Defendant.Builder builder = Defendant.defendant().withValuesFrom(defendant);
final Defendant latestDefendant = this.defendantsMap.getOrDefault(defendant.getId(), defendant);
final Defendant.Builder builder = Defendant.defendant().withValuesFrom(latestDefendant);
applyDefendantFallbacks(defendant, latestDefendant, builder);
uk.gov.moj.cpp.progression.events.CustodialEstablishment custodialEstablishment = defendantCustodialEstablishmentMap.get(defendant.getId());
if (custodialEstablishment != null) {
final uk.gov.justice.core.courts.CustodialEstablishment.Builder custodialEstablishmentBuilder = uk.gov.justice.core.courts.CustodialEstablishment.custodialEstablishment();
custodialEstablishmentBuilder.withCustody(custodialEstablishment.getCustody())
.withId(custodialEstablishment.getId())
.withName(custodialEstablishment.getName());
Defendant latestDefendant = this.defendantsMap.get(defendant.getId());
PersonDefendant personDefendant = PersonDefendant.personDefendant().withValuesFrom(defendant.getPersonDefendant())
.withBailStatus(latestDefendant.getPersonDefendant().getBailStatus())
.withCustodialEstablishment(custodialEstablishmentBuilder.build()).build();
builder.withPersonDefendant(personDefendant);
final PersonDefendant basePersonDefendant = nonNull(latestDefendant.getPersonDefendant())
? latestDefendant.getPersonDefendant()
: defendant.getPersonDefendant();
if (nonNull(basePersonDefendant)) {
final PersonDefendant personDefendant = PersonDefendant.personDefendant().withValuesFrom(basePersonDefendant)
.withBailStatus(latestDefendant.getPersonDefendant() != null
? latestDefendant.getPersonDefendant().getBailStatus()
: basePersonDefendant.getBailStatus())
.withCustodialEstablishment(custodialEstablishmentBuilder.build()).build();
builder.withPersonDefendant(personDefendant);
}
}
defendantList.add(builder.withOffences(offenceSet.stream().collect(toList()))
.build());
Expand All @@ -649,6 +657,61 @@ private void handleProsecutionCaseOffencesUpdated(final ProsecutionCaseOffencesU

}

private void applyDefendantFallbacks(final Defendant fallbackDefendant, final Defendant latestDefendant, final Defendant.Builder builder) {
if (isNull(latestDefendant.getMasterDefendantId()) && nonNull(fallbackDefendant.getMasterDefendantId())) {
builder.withMasterDefendantId(fallbackDefendant.getMasterDefendantId());
}
if (isNull(latestDefendant.getProsecutionCaseId()) && nonNull(fallbackDefendant.getProsecutionCaseId())) {
builder.withProsecutionCaseId(fallbackDefendant.getProsecutionCaseId());
}
if (isNull(latestDefendant.getNumberOfPreviousConvictionsCited()) && nonNull(fallbackDefendant.getNumberOfPreviousConvictionsCited())) {
builder.withNumberOfPreviousConvictionsCited(fallbackDefendant.getNumberOfPreviousConvictionsCited());
}
if (isNull(latestDefendant.getProsecutionAuthorityReference()) && nonNull(fallbackDefendant.getProsecutionAuthorityReference())) {
builder.withProsecutionAuthorityReference(fallbackDefendant.getProsecutionAuthorityReference());
}
if (isNull(latestDefendant.getWitnessStatement()) && nonNull(fallbackDefendant.getWitnessStatement())) {
builder.withWitnessStatement(fallbackDefendant.getWitnessStatement());
}
if (isNull(latestDefendant.getWitnessStatementWelsh()) && nonNull(fallbackDefendant.getWitnessStatementWelsh())) {
builder.withWitnessStatementWelsh(fallbackDefendant.getWitnessStatementWelsh());
}
if (isNull(latestDefendant.getMitigation()) && nonNull(fallbackDefendant.getMitigation())) {
builder.withMitigation(fallbackDefendant.getMitigation());
}
if (isNull(latestDefendant.getMitigationWelsh()) && nonNull(fallbackDefendant.getMitigationWelsh())) {
builder.withMitigationWelsh(fallbackDefendant.getMitigationWelsh());
}
if (isNull(latestDefendant.getAssociatedPersons()) && nonNull(fallbackDefendant.getAssociatedPersons())) {
builder.withAssociatedPersons(fallbackDefendant.getAssociatedPersons());
}
if (isNull(latestDefendant.getDefenceOrganisation()) && nonNull(fallbackDefendant.getDefenceOrganisation())) {
builder.withDefenceOrganisation(fallbackDefendant.getDefenceOrganisation());
}
if (isNull(latestDefendant.getPersonDefendant()) && nonNull(fallbackDefendant.getPersonDefendant())) {
builder.withPersonDefendant(fallbackDefendant.getPersonDefendant());
}
if (isNull(latestDefendant.getLegalEntityDefendant()) && nonNull(fallbackDefendant.getLegalEntityDefendant())) {
builder.withLegalEntityDefendant(fallbackDefendant.getLegalEntityDefendant());
}
if (isNull(latestDefendant.getPncId()) && nonNull(fallbackDefendant.getPncId())) {
builder.withPncId(fallbackDefendant.getPncId());
}
if (isNull(latestDefendant.getAliases()) && nonNull(fallbackDefendant.getAliases())) {
builder.withAliases(fallbackDefendant.getAliases());
}
if (isNull(latestDefendant.getIsYouth()) && nonNull(fallbackDefendant.getIsYouth())) {
builder.withIsYouth(fallbackDefendant.getIsYouth());
}
if (isNull(latestDefendant.getAssociatedDefenceOrganisation()) && nonNull(fallbackDefendant.getAssociatedDefenceOrganisation())) {
builder.withAssociatedDefenceOrganisation(fallbackDefendant.getAssociatedDefenceOrganisation());
}
if (isNull(latestDefendant.getCroNumber()) && nonNull(fallbackDefendant.getCroNumber())) {
builder.withCroNumber(fallbackDefendant.getCroNumber());
}

}

private void handleListingNumberDecreased(final ProsecutionCaseListingNumberDecreased prosecutionCaseListingNumberDecreased) {
final Set<UUID> listingSet = prosecutionCaseListingNumberDecreased.getOffenceIds().stream().collect(Collectors.toSet());

Expand Down
Loading