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
0592478
commit 4a50439
Showing
27 changed files
with
1,076 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
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
116 changes: 116 additions & 0 deletions
116
...er-profile-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/entity/Entities.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,116 @@ | ||
package uk.gov.justice.digital.hmpps.data.entity | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Convert | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import org.hibernate.type.YesNoConverter | ||
import java.time.LocalDate | ||
|
||
@Entity | ||
class AddressAssessment(@Id val addressAssessmentId: Long, val assessmentDate: LocalDate) | ||
|
||
@Entity | ||
class ApprovedPremisesReferral( | ||
@Id val approvedPremisesReferralId: Long, | ||
val referralDate: LocalDate, | ||
val eventId: Long? | ||
) | ||
|
||
@Entity | ||
class Assessment( | ||
@Id val assessmentId: Long, | ||
val assessmentTypeId: Long, | ||
val referralId: Long?, | ||
val assessmentDate: LocalDate | ||
) | ||
|
||
@Entity | ||
@Table(name = "r_assessment_type") | ||
class AssessmentType(@Id val assessmentTypeId: Long, val description: String) | ||
|
||
@Entity | ||
class CaseAllocation(@Id val caseAllocationId: Long, val eventId: Long) | ||
|
||
@Entity | ||
class Contact(@Id val contactId: Long, val contactTypeId: Long, val eventId: Long?, val contactDate: LocalDate) | ||
|
||
@Entity | ||
@Table(name = "r_contact_type") | ||
class ContactType(@Id val contactTypeId: Long, val description: String) | ||
|
||
@Entity | ||
class Court(@Id val courtId: Long, val courtName: String) | ||
|
||
@Entity | ||
@Table(name = "r_court_report_type") | ||
class CourtReportType(@Id val courtReportTypeId: Long, val description: String) | ||
|
||
@Entity | ||
class CourtReport( | ||
@Id val courtReportId: Long, | ||
val courtReportTypeId: Long, | ||
val courtAppearanceId: Long, | ||
val dateRequested: LocalDate | ||
) | ||
|
||
@Entity | ||
class InstitutionalReport( | ||
@Id | ||
val institutionalReportId: Long, | ||
val institutionReportTypeId: Long, | ||
val institutionId: Long, | ||
@Convert(converter = YesNoConverter::class) | ||
val establishment: Boolean, | ||
val custodyId: Long, | ||
val dateRequested: LocalDate | ||
) | ||
|
||
@Entity | ||
class Nsi(@Id val nsiId: Long, val nsiTypeId: Long, val eventId: Long?, val referralDate: LocalDate) | ||
|
||
@Entity | ||
@Table(name = "r_nsi_type") | ||
class NsiType(@Id val nsiTypeId: Long, val description: String) | ||
|
||
@Entity | ||
class PersonalCircumstance(@Id val personalCircumstanceId: Long, val circumstanceTypeId: Long, val startDate: LocalDate) | ||
|
||
@Entity | ||
@Table(name = "r_circumstance_type") | ||
class PersonalCircumstanceType(@Id val circumstanceTypeId: Long, val codeDescription: String) | ||
|
||
@Entity | ||
class PersonalContact(@Id val personalContactId: Long, val relationshipTypeId: Long, val relationship: String) | ||
|
||
@Entity | ||
class Referral(@Id val referralId: Long, val referralTypeId: Long, val referralDate: LocalDate, val eventId: Long) | ||
|
||
@Entity | ||
@Table(name = "r_referral_type") | ||
class ReferralType(@Id val referralTypeId: Long, val description: String) | ||
|
||
@Entity | ||
class UpwAppointment( | ||
@Id val upwAppointmentId: Long, | ||
val upwDetailsId: Long, | ||
val upwProjectId: Long, | ||
val appointmentDate: LocalDate | ||
) | ||
|
||
@Entity | ||
class UpwDetails(@Id val upwDetailsId: Long, val disposalId: Long) | ||
|
||
@Entity | ||
class UpwProject(@Id val upwProjectId: Long, val name: String) | ||
|
||
@Entity | ||
@Table(name = "user_") | ||
class User( | ||
@Id | ||
@Column(name = "user_id") | ||
val userId: Long, | ||
val forename: String, | ||
val surname: 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
41 changes: 41 additions & 0 deletions
41
...nd-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/generator/DocumentGenerator.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,41 @@ | ||
package uk.gov.justice.digital.hmpps.data.generator | ||
|
||
import uk.gov.justice.digital.hmpps.integrations.delius.documents.entity.DocumentEntity | ||
import java.time.ZonedDateTime | ||
import java.util.* | ||
|
||
object DocumentGenerator { | ||
val OFFENDER = generate("OFFENDER", primaryKeyId = PersonGenerator.DEFAULT.id, alfrescoId = "uuid1") | ||
val PREVIOUS_CONVICTIONS = generate("OFFENDER", "PREVIOUS_CONVICTION", primaryKeyId = PersonGenerator.DEFAULT.id) | ||
val EVENT = generate("EVENT", primaryKeyId = EventGenerator.EVENT.id) | ||
val CPS_PACK = generate("EVENT", "CPS_PACK", primaryKeyId = EventGenerator.EVENT.id) | ||
val ADDRESSASSESSMENT = generate("ADDRESSASSESSMENT") | ||
val PERSONALCONTACT = generate("PERSONALCONTACT") | ||
val PERSONAL_CIRCUMSTANCE = generate("PERSONAL_CIRCUMSTANCE") | ||
val COURT_REPORT = generate("COURT_REPORT", primaryKeyId = EventGenerator.COURT_REPORT.courtReportId) | ||
val INSTITUTIONAL_REPORT = | ||
generate("INSTITUTIONAL_REPORT", primaryKeyId = EventGenerator.INSTITUTIONAL_REPORT.institutionalReportId) | ||
val OFFENDER_CONTACT = generate("CONTACT") | ||
val EVENT_CONTACT = generate("CONTACT", primaryKeyId = EventGenerator.CONTACT.contactId) | ||
val OFFENDER_NSI = generate("NSI") | ||
val EVENT_NSI = generate("NSI", primaryKeyId = EventGenerator.NSI.nsiId) | ||
|
||
fun generate( | ||
tableName: String, | ||
type: String = "DOCUMENT", | ||
primaryKeyId: Long = 0, | ||
alfrescoId: String = UUID.randomUUID().toString() | ||
) = DocumentEntity( | ||
id = IdGenerator.getAndIncrement(), | ||
personId = PersonGenerator.DEFAULT.id, | ||
alfrescoId = alfrescoId, | ||
primaryKeyId = primaryKeyId, | ||
name = "$tableName-related document", | ||
type = type, | ||
tableName = tableName, | ||
createdAt = ZonedDateTime.now(), | ||
createdByUserId = 0, | ||
lastUpdatedUserId = 0, | ||
softDeleted = false | ||
) | ||
} |
Oops, something went wrong.