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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ba8d973
commit 90be6df
Showing
33 changed files
with
924 additions
and
282 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
36 changes: 21 additions & 15 deletions
36
...elius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/RegistrationGenerator.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,46 +1,52 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.data.generator.ReferenceDataGenerator.ROSH_FLAG | ||
import uk.gov.justice.digital.hmpps.enum.RiskOfSeriousHarmType | ||
import uk.gov.justice.digital.hmpps.enum.RiskType | ||
import uk.gov.justice.digital.hmpps.integrations.delius.contact.entity.Contact | ||
import uk.gov.justice.digital.hmpps.integrations.delius.contact.entity.ContactType | ||
import uk.gov.justice.digital.hmpps.integrations.delius.person.entity.RegisterType | ||
import uk.gov.justice.digital.hmpps.integrations.delius.person.entity.Registration | ||
import uk.gov.justice.digital.hmpps.integrations.delius.referencedata.entity.ReferenceData | ||
import uk.gov.justice.digital.hmpps.service.Risk | ||
import java.time.LocalDate | ||
|
||
object RegistrationGenerator { | ||
|
||
val TYPES = Risk.entries.map { | ||
generateType( | ||
it.code, colour = when (it) { | ||
Risk.V -> "Red" | ||
Risk.H -> "Orange" | ||
Risk.M -> "Amber" | ||
Risk.L -> "Green" | ||
} | ||
) | ||
}.associateBy { it.code } | ||
val TYPES = listOf( | ||
RiskOfSeriousHarmType.entries.map { generateType(it.code, it.colour, flag = ROSH_FLAG) }, | ||
RiskType.entries.map { generateType(it.code, "Amber", "Risk to ${it.name.lowercase()}") } | ||
).flatten().associateBy { it.code } | ||
|
||
val RiskOfSeriousHarmType.colour | ||
get() = when (this) { | ||
RiskOfSeriousHarmType.V -> "Red" | ||
RiskOfSeriousHarmType.H -> "Orange" | ||
RiskOfSeriousHarmType.M -> "Amber" | ||
RiskOfSeriousHarmType.L -> "Green" | ||
} | ||
|
||
fun generate( | ||
personId: Long, | ||
date: LocalDate, | ||
type: RegisterType, | ||
contact: Contact, | ||
type: RegisterType, | ||
level: ReferenceData? = null, | ||
teamId: Long = ProviderGenerator.DEFAULT_TEAM_ID, | ||
staffId: Long = ProviderGenerator.DEFAULT_STAFF_ID, | ||
nextReviewDate: LocalDate? = type.reviewPeriod?.let { date.plusMonths(it) }, | ||
notes: String? = null, | ||
softDeleted: Boolean = false, | ||
id: Long = IdGenerator.getAndIncrement() | ||
) = Registration(personId, date, contact, teamId, staffId, type, nextReviewDate, softDeleted, id) | ||
) = Registration(personId, date, contact, teamId, staffId, type, level, nextReviewDate, notes, softDeleted, id) | ||
|
||
fun generateType( | ||
code: String, | ||
colour: String, | ||
description: String = "Description of $code", | ||
flag: ReferenceData = ReferenceDataGenerator.DEFAULT_FLAG, | ||
flag: ReferenceData = ReferenceDataGenerator.SAFEGUARDING_FLAG, | ||
registrationContactType: ContactType? = ContactGenerator.TYPES[ContactType.Code.REGISTRATION.value], | ||
reviewContactType: ContactType? = ContactGenerator.TYPES[ContactType.Code.REGISTRATION_REVIEW.value], | ||
reviewPeriod: Long? = 6, | ||
colour: String? = null, | ||
id: Long = IdGenerator.getAndIncrement() | ||
) = RegisterType(code, description, flag, registrationContactType, reviewPeriod, reviewContactType, colour, id) | ||
} |
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-F123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-G123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-H123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-L123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-M123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-N123456.json
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...nt-summary-and-delius/src/dev/resources/messages/assessment-summary-produced-O123456.json
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../assessment-summary-produced-E123456.json → ...messages/assessment-summary-produced.json
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
4 changes: 2 additions & 2 deletions
4
...s/__files/assessment-summary-N123456.json → .../simulations/__files/A000001-no-rosh.json
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
4 changes: 2 additions & 2 deletions
4
...s/__files/assessment-summary-L123456.json → ...simulations/__files/A000002-low-rosh.json
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
4 changes: 2 additions & 2 deletions
4
...s/__files/assessment-summary-M123456.json → ...ulations/__files/A000003-medium-rosh.json
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
4 changes: 2 additions & 2 deletions
4
...s/__files/assessment-summary-F123456.json → ...imulations/__files/A000004-high-rosh.json
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
Oops, something went wrong.