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.
- Loading branch information
1 parent
47898a5
commit cb43430
Showing
8 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/AdditionalSentenceGenerator.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,33 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.integrations.delius.overview.entity.Event | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData | ||
import uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity.AdditionalSentence | ||
|
||
object AdditionalSentenceGenerator { | ||
|
||
val DISQ = generateReferenceDate("DISQ", "Disqualified from Driving") | ||
val FINE = generateReferenceDate("FINE", "Fine") | ||
|
||
val SENTENCE_DISQ = generateSentence(length = 3, referenceData = DISQ) | ||
val SENTENCE_FINE = generateSentence(amount = 500, referenceData = FINE) | ||
fun generateSentence( | ||
length: Long? = null, | ||
amount: Long? = null, | ||
notes: String? = null, | ||
event: Event? = null, | ||
referenceData: ReferenceData | ||
) = AdditionalSentence( | ||
IdGenerator.getAndIncrement(), | ||
length, | ||
amount, | ||
notes, | ||
false, | ||
event, | ||
referenceData | ||
) | ||
|
||
fun generateReferenceDate(code: String, description: String) = | ||
ReferenceData(IdGenerator.getAndIncrement(), code, description) | ||
} | ||
|
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
8 changes: 8 additions & 0 deletions
8
...lius/src/main/kotlin/uk/gov/justice/digital/hmpps/api/model/sentence/AdditionalSentece.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,8 @@ | ||
package uk.gov.justice.digital.hmpps.api.model.sentence | ||
|
||
data class AdditionalSentence( | ||
val length: Long?, | ||
val amount: Long?, | ||
val notes: String?, | ||
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
40 changes: 40 additions & 0 deletions
40
...in/uk/gov/justice/digital/hmpps/integrations/delius/sentence/entity/AdditionalSentence.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,40 @@ | ||
package uk.gov.justice.digital.hmpps.integrations.delius.sentence.entity | ||
|
||
import jakarta.persistence.* | ||
import org.hibernate.annotations.Immutable | ||
import org.hibernate.annotations.SQLRestriction | ||
import uk.gov.justice.digital.hmpps.integrations.delius.overview.entity.Event | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData | ||
|
||
@Immutable | ||
@Entity | ||
@Table(name = "additional_sentence") | ||
@SQLRestriction("soft_deleted = 0") | ||
class AdditionalSentence ( | ||
|
||
@Id | ||
@Column(name = "additional_sentence_id") | ||
val id: Long, | ||
|
||
@Column(name = "length") | ||
val length: Long? = null, | ||
|
||
@Column(name = "amount") | ||
val amount: Long? = null, | ||
|
||
@Lob | ||
@Column(name = "notes") | ||
val notes: String? = null, | ||
|
||
@Column(columnDefinition = "number") | ||
val softDeleted: Boolean = false, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "event_id", nullable = false) | ||
val event: Event? = null, | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "additional_sentence_type_id") | ||
val refData: ReferenceData? = 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
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