generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/pi 1939 mas probabtion history (#3596)
* PI-1939 - add probation history Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add probation history Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add probation history Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - refactor variable names Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add professional contact details Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add professional contact details Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add professional contact details Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - add professional contact details Signed-off-by: Amardeep Chimber <[email protected]> * PI-1939 - update tests * PI-1939 - use offender_manager instead of perseonal_contact table for probabtion history Signed-off-by: Amardeep Chimber <[email protected]> * Formatting changes * PI-1939 - add most recent termination date from inactive events to probation history Signed-off-by: Amardeep Chimber <[email protected]> --------- Signed-off-by: Amardeep Chimber <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5e3b5db
commit 2dd1f93
Showing
17 changed files
with
228 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 58 additions & 6 deletions
64
...delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/CourtReportGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,67 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.CourtAppearance | ||
import uk.gov.justice.digital.hmpps.integrations.delius.personalDetails.entity.CourtReportDocument | ||
import uk.gov.justice.digital.hmpps.integrations.delius.personalDetails.entity.EventDocument | ||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.CourtReport | ||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.CourtReportType | ||
import java.time.ZonedDateTime | ||
|
||
object CourtReportGenerator { | ||
|
||
val COURT_APPEARANCE = CourtAppearanceGenerator.generate() | ||
val DEFAULT_TYPE = CourtReportType(IdGenerator.getAndIncrement(), "Pre-Sentence Report - Fast") | ||
val COURT_REPORT = generate(DEFAULT_TYPE, CourtAppearanceGenerator.COURT_APPEARANCE) | ||
fun generate( | ||
courtReportType: CourtReportType?, | ||
courtAppearance: CourtAppearance | ||
) = CourtReport(IdGenerator.getAndIncrement(), courtReportType, courtAppearance) | ||
val COURT_REPORT_TYPE = DEFAULT_TYPE | ||
val COURT_REPORT = CourtReport(IdGenerator.getAndIncrement(), COURT_REPORT_TYPE, COURT_APPEARANCE) | ||
|
||
val COURT_DOCUMENT = generateCourtDocument( | ||
PersonGenerator.OVERVIEW.id, | ||
"A003", | ||
"court report", | ||
"DOCUMENT", | ||
COURT_REPORT.courtReportId | ||
) | ||
|
||
val EVENT_DOCUMENT = generateEventDocument( | ||
PersonGenerator.OVERVIEW.id, | ||
"A004", | ||
"event report", | ||
"DOCUMENT", | ||
PersonGenerator.EVENT_1.id | ||
) | ||
|
||
fun generateCourtDocument( | ||
personId: Long, | ||
alfrescoId: String, | ||
name: String, | ||
documentType: String, | ||
primaryKeyId: Long? = null | ||
): CourtReportDocument { | ||
val doc = CourtReportDocument() | ||
doc.id = IdGenerator.getAndIncrement() | ||
doc.lastUpdated = ZonedDateTime.now().minusDays(1) | ||
doc.alfrescoId = alfrescoId | ||
doc.name = name | ||
doc.personId = personId | ||
doc.primaryKeyId = primaryKeyId | ||
doc.type = documentType | ||
return doc | ||
} | ||
|
||
fun generateEventDocument( | ||
personId: Long, | ||
alfrescoId: String, | ||
name: String, | ||
documentType: String, | ||
primaryKeyId: Long? = null | ||
): EventDocument { | ||
val doc = EventDocument() | ||
doc.id = IdGenerator.getAndIncrement() | ||
doc.lastUpdated = ZonedDateTime.now().minusDays(3) | ||
doc.alfrescoId = alfrescoId | ||
doc.name = name | ||
doc.personId = personId | ||
doc.primaryKeyId = primaryKeyId | ||
doc.type = documentType | ||
return doc | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...us/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/OffenderManagerGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.OffenderManager | ||
import java.time.LocalDate | ||
|
||
object OffenderManagerGenerator { | ||
|
||
val OFFENDER_MANAGER_ACTIVE = | ||
OffenderManager(IdGenerator.getAndIncrement(), PersonGenerator.OVERVIEW, null, 1234, null) | ||
val OFFENDER_MANAGER_INACTIVE = | ||
OffenderManager(IdGenerator.getAndIncrement(), PersonGenerator.OVERVIEW, null, 1234, LocalDate.now()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...elius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/ProbationHistory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package uk.gov.justice.digital.hmpps.api.model.sentence | ||
|
||
import java.time.LocalDate | ||
|
||
data class ProbationHistory( | ||
val numberOfTerminatedEvents: Int, | ||
val dateOfMostRecentTerminatedEvent: LocalDate?, | ||
val numberOfTerminatedEventBreaches: Int, | ||
val numberOfProfessionalContacts: Long | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...justice/digital/hmpps/integrations/delius/referencedata/entity/ReferenceDataLinkedList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity | ||
|
||
import jakarta.persistence.* | ||
import org.hibernate.annotations.Immutable | ||
import java.io.Serializable | ||
|
||
@Entity | ||
@Table(name = "r_linked_list") | ||
@Immutable | ||
class ReferenceDataLinkedList( | ||
@Id | ||
val id: ReferenceDataLinkedListId | ||
) | ||
|
||
@Embeddable | ||
class ReferenceDataLinkedListId( | ||
@Column(name = "STANDARD_REFERENCE_DATA1") | ||
val data1: Long, | ||
|
||
@Column(name = "STANDARD_REFERENCE_DATA2") | ||
val data2: Long | ||
) : Serializable |
Oops, something went wrong.