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.
Man 28 sentence license condition notes (#4321)
* MAN-28 - add licence condition information to api * MAN-28 - update model from nullable list to non nullable list * MAN-28 - update model so that notes are sent as a list * Formatting changes * MAN-28 - process note without 'Comment added by...' * Formatting changes * MAN-28 - process note without 'Comment added by...' * MAN-28 - update LicenceConditionNote.createdBy * MAN-28 - add new attribute to response * Formatting changes * MAN-28 - limit licence note to 1500 characters * MAN-28 - limit licence note to 1500 characters * MAN-28 - remove characters not needed * MAN-28 - apply review comments --------- Co-authored-by: probation-integration-bot[bot] <177347787+probation-integration-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6cff799
commit 35dce3c
Showing
8 changed files
with
253 additions
and
6 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
62 changes: 62 additions & 0 deletions
62
...s/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/LicenceConditionGenerator.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,62 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator.ACTIVE_ORDER | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData | ||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.LicenceCondition | ||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.LicenceConditionMainCategory | ||
import java.time.LocalDate | ||
|
||
object LicenceConditionGenerator { | ||
|
||
val LIC_COND_MAIN_CAT = LicenceConditionMainCategory( | ||
IdGenerator.getAndIncrement(), | ||
"LicMain", | ||
"lic cond main" | ||
) | ||
|
||
val LIC_COND_SUB_CAT = ReferenceData( | ||
IdGenerator.getAndIncrement(), | ||
"LicSub", | ||
"Lic Sub cat" | ||
) | ||
|
||
val LC_WITHOUT_NOTES = LicenceCondition( | ||
IdGenerator.getAndIncrement(), | ||
LIC_COND_MAIN_CAT, | ||
null, | ||
ACTIVE_ORDER.id, | ||
LocalDate.now().minusDays(14), | ||
null, | ||
null | ||
) | ||
|
||
val LC_WITH_NOTES = LicenceCondition( | ||
IdGenerator.getAndIncrement(), | ||
LIC_COND_MAIN_CAT, | ||
LIC_COND_SUB_CAT, | ||
ACTIVE_ORDER.id, | ||
LocalDate.now().minusDays(7), | ||
LocalDate.now(), | ||
""" | ||
Comment added by CVL Service on 22/04/2024 at 10:00 | ||
Licence Condition created automatically from the Create and Vary a licence system of\nAllow person(s) as designated by your supervising officer to install an electronic monitoring tag on you and access to install any associated equipment in your property, and for the purpose of ensuring that equipment is functioning correctly. You must not damage or tamper with these devices and ensure that the tag is charged, and report to your supervising officer and the EM provider immediately if the tag or the associated equipment are not working correctly. This will be for the purpose of monitoring your alcohol abstinence licence condition(s) unless otherwise authorised by your supervising officer. Licence Condition created automatically from the Create and Vary a licence system of\nAllow person(s) as designated by your supervising officer to install an electronic monitoring tag on you and access to install any associated equipment in your property, and for the purpose of ensuring that equipment is functioning correctly. You must not damage or tamper with these devices and ensure that the tag is charged, and report to your supervising officer and the EM provider immediately if the tag or the associated equipment are not working correctly. This will be for the purpose of monitoring your alcohol abstinence licence condition(s) unless otherwise authorised by your supervising officer.Licence Condition created automatically from the Create and Vary a licence system of\nAllow person(s) as desi123456 | ||
--------------------------------------------------------- | ||
Comment added by Joe Root on 23/04/2024 at 13:45 | ||
You must not drink any alcohol until Wednesday 7th August 2024 unless your | ||
probation officer says you can. You will need to wear an electronic tag all the time so | ||
we can check this. | ||
""".trimIndent() | ||
) | ||
|
||
val LC_WITH_NOTES_WITHOUT_ADDED_BY = LicenceCondition( | ||
IdGenerator.getAndIncrement(), | ||
LIC_COND_MAIN_CAT, | ||
LIC_COND_SUB_CAT, | ||
ACTIVE_ORDER.id, | ||
LocalDate.now().minusDays(7), | ||
LocalDate.now(), | ||
""" | ||
He shall not contact or associate with Peter Jones without the prior approval of the supervising officer; | ||
""".trimIndent() | ||
) | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...elius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/LicenceCondition.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,18 @@ | ||
package uk.gov.justice.digital.hmpps.api.model.sentence | ||
|
||
import java.time.LocalDate | ||
|
||
data class LicenceCondition( | ||
val mainDescription: String, | ||
val subTypeDescription: String? = null, | ||
val imposedReleasedDate: LocalDate, | ||
val actualStartDate: LocalDate? = null, | ||
val notes: List<LicenceConditionNote> = listOf() | ||
) | ||
|
||
data class LicenceConditionNote( | ||
val createdBy: String? = null, | ||
val createdByDate: LocalDate? = null, | ||
val note: String, | ||
val hasNotesBeenTruncated: Boolean? = null | ||
) |
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
63 changes: 63 additions & 0 deletions
63
...tlin/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/LicenceCondition.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,63 @@ | ||
package uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity | ||
|
||
import jakarta.persistence.* | ||
import org.hibernate.annotations.Immutable | ||
import org.hibernate.annotations.SQLRestriction | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData | ||
import java.time.LocalDate | ||
|
||
@Immutable | ||
@Entity | ||
@Table(name = "lic_condition") | ||
@SQLRestriction("soft_deleted = 0 and active_flag = 1") | ||
class LicenceCondition( | ||
@Id | ||
@Column(name = "lic_condition_id", nullable = false) | ||
val id: Long, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "lic_cond_type_main_cat_id") | ||
val mainCategory: LicenceConditionMainCategory, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "lic_cond_type_sub_cat_id") | ||
val subCategory: ReferenceData?, | ||
|
||
@Column | ||
val disposalId: Long, | ||
|
||
@Column(name = "start_date", nullable = false) | ||
val imposedReleasedDate: LocalDate, | ||
|
||
@Column(name = "commencement_date") | ||
val actualStartDate: LocalDate?, | ||
|
||
@Column(name = "lic_condition_notes", columnDefinition = "clob") | ||
val notes: String?, | ||
|
||
@Column(name = "active_flag", columnDefinition = "number", nullable = false) | ||
val active: Boolean = true, | ||
|
||
@Column(columnDefinition = "number") | ||
val softDeleted: Boolean = false | ||
) | ||
|
||
interface LicenceConditionRepository : JpaRepository<LicenceCondition, Long> { | ||
fun findAllByDisposalId(disposalId: Long): List<LicenceCondition> | ||
} | ||
|
||
@Immutable | ||
@Table(name = "r_lic_cond_type_main_cat") | ||
@Entity | ||
class LicenceConditionMainCategory( | ||
@Id | ||
@Column(name = "lic_cond_type_main_cat_id") | ||
val id: Long, | ||
|
||
@Column | ||
val code: String, | ||
|
||
@Column | ||
val description: String | ||
) |
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