Skip to content

Commit

Permalink
Merge branch 'main' into MAN-109-backend-create-appointment-in-mms
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Oct 29, 2024
2 parents e913cbe + 1917b50 commit 3bbdaf5
Show file tree
Hide file tree
Showing 101 changed files with 2,054 additions and 272 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
kotlin("jvm") version "2.0.21"
kotlin("plugin.spring") version "2.0.21" apply false
kotlin("plugin.jpa") version "2.0.21" apply false
id("org.springframework.boot") version "3.3.4" apply false
id("org.springframework.boot") version "3.3.5" apply false
id("io.spring.dependency-management") version "1.1.6" apply false
id("com.gorylenko.gradle-git-properties") version "2.4.2" apply false
id("com.google.cloud.tools.jib") apply false
Expand Down
4 changes: 1 addition & 3 deletions doc/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.awspring.cloud.sqs.listener.AsyncAdapterBlockingExecutionFailedExcepti
import io.awspring.cloud.sqs.listener.ListenerExecutionFailedException
import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.SpanKind
import io.opentelemetry.api.trace.StatusCode
import io.sentry.Sentry
import io.sentry.spring.jakarta.tracing.SentryTransaction
import org.springframework.beans.factory.annotation.Value
Expand Down Expand Up @@ -53,9 +54,11 @@ class AwsNotificationListener(
}
try {
retry(3, RETRYABLE_EXCEPTIONS) { handler.handle(message) }
} catch (e: Throwable) {
Sentry.captureException(unwrapSqsExceptions(e))
throw e
} catch (t: Throwable) {
val e = unwrapSqsExceptions(t)
Span.current().recordException(e).setStatus(StatusCode.ERROR)
Sentry.captureException(e)
throw t
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
4 changes: 1 addition & 3 deletions projects/approved-premises-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
4 changes: 1 addition & 3 deletions projects/approved-premises-and-oasys/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
4 changes: 1 addition & 3 deletions projects/arns-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
4 changes: 1 addition & 3 deletions projects/cas2-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
4 changes: 1 addition & 3 deletions projects/cas3-and-delius/tech-docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redcarpet (3.5.1)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
sass (3.4.25)
sassc (2.4.0)
Expand All @@ -155,7 +154,6 @@ GEM
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
strscan (3.1.0)
temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
Expand Down
11 changes: 10 additions & 1 deletion projects/common-platform-and-delius/deploy/database/access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ database:
username_key: /common-platform-and-delius/db-username
password_key: /common-platform-and-delius/db-password

tables:
- offender
- offender_manager
- equality
- audited_interaction
- offender_address
packages:
- offender_support_api # for generating crn

audit:
username: CommonPlatformAndDelius
forename: Common Platform
surname: Service
surname: Service
3 changes: 1 addition & 2 deletions projects/common-platform-and-delius/deploy/values-dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
enabled: false

generic-service:
ingress:
host: common-platform-and-delius-dev.hmpps.service.justice.gov.uk
Expand All @@ -11,6 +9,7 @@ generic-service:
SENTRY_ENVIRONMENT: dev
LOGGING_LEVEL_UK_GOV_DIGITAL_JUSTICE_HMPPS: DEBUG
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/oauth/token
INTEGRATIONS_PROBATION-SEARCH_URL: https://probation-offender-search-dev.hmpps.service.justice.gov.uk

generic-prometheus-alerts:
businessHoursOnly: true
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
enabled: false

generic-service:
ingress:
host: common-platform-and-delius-preprod.hmpps.service.justice.gov.uk
Expand All @@ -10,6 +8,7 @@ generic-service:
env:
SENTRY_ENVIRONMENT: preprod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/oauth/token
INTEGRATIONS_PROBATION-SEARCH_URL: https://probation-offender-search-preprod.hmpps.service.justice.gov.uk

generic-prometheus-alerts:
businessHoursOnly: true
1 change: 1 addition & 0 deletions projects/common-platform-and-delius/deploy/values-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ generic-service:
env:
SENTRY_ENVIRONMENT: prod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in.hmpps.service.justice.gov.uk/auth/oauth/token
INTEGRATIONS_PROBATION-SEARCH_URL: https://probation-offender-search.hmpps.service.justice.gov.uk
2 changes: 2 additions & 0 deletions projects/common-platform-and-delius/deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ generic-service:
SENTRY_DSN: SENTRY_DSN
common-platform-and-delius-queue:
MESSAGING_CONSUMER_QUEUE: QUEUE_NAME
hmpps-domain-events-topic:
MESSAGING_PRODUCER_TOPIC: topic_arn

generic-prometheus-alerts:
targetApplication: common-platform-and-delius
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package uk.gov.justice.digital.hmpps.data

import jakarta.annotation.PostConstruct
import jakarta.persistence.EntityManager
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.ApplicationListener
import org.springframework.stereotype.Component
import uk.gov.justice.digital.hmpps.data.generator.UserGenerator
import org.springframework.transaction.annotation.Transactional
import uk.gov.justice.digital.hmpps.data.generator.*
import uk.gov.justice.digital.hmpps.user.AuditUserRepository

@Component
@ConditionalOnProperty("seed.database")
class DataLoader(
private val entityManager: EntityManager,
private val auditUserRepository: AuditUserRepository
) : ApplicationListener<ApplicationReadyEvent> {

Expand All @@ -19,7 +22,26 @@ class DataLoader(
auditUserRepository.save(UserGenerator.AUDIT_USER)
}

@Transactional
override fun onApplicationEvent(are: ApplicationReadyEvent) {
// Perform dev/test database setup here, using JPA repositories and generator classes...
entityManager.run {
persist(BusinessInteractionGenerator.INSERT_PERSON)
persist(BusinessInteractionGenerator.INSERT_ADDRESS)
persist(DatasetGenerator.GENDER)
persist(DatasetGenerator.OM_ALLOCATION_REASON)
persist(DatasetGenerator.ADDRESS_STATUS)
persist(DatasetGenerator.ADDRESS_TYPE)
persist(ReferenceDataGenerator.GENDER_MALE)
persist(ReferenceDataGenerator.GENDER_FEMALE)
persist(ReferenceDataGenerator.INITIAL_ALLOCATION)
persist(ReferenceDataGenerator.MAIN_ADDRESS_STATUS)
persist(ReferenceDataGenerator.AWAITING_ASSESSMENT)
persist(ProviderGenerator.DEFAULT)
persist(TeamGenerator.ALLOCATED)
persist(TeamGenerator.UNALLOCATED)
persist(StaffGenerator.UNALLOCATED)
persist(StaffGenerator.ALLOCATED)
persist(CourtGenerator.UNKNOWN_COURT_N07_PROVIDER)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package uk.gov.justice.digital.hmpps.data.generator

import uk.gov.justice.digital.hmpps.audit.BusinessInteraction
import uk.gov.justice.digital.hmpps.integrations.delius.audit.BusinessInteractionCode
import java.time.ZonedDateTime

object BusinessInteractionGenerator {
val INSERT_PERSON = BusinessInteraction(
IdGenerator.getAndIncrement(),
BusinessInteractionCode.INSERT_PERSON.code,
ZonedDateTime.now().minusMonths(6)
)
val INSERT_ADDRESS = BusinessInteraction(
IdGenerator.getAndIncrement(),
BusinessInteractionCode.INSERT_ADDRESS.code,
ZonedDateTime.now().minusMonths(6)
)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
package uk.gov.justice.digital.hmpps.data.generator

import uk.gov.justice.digital.hmpps.message.HmppsDomainEvent
import uk.gov.justice.digital.hmpps.messaging.CommonPlatformHearing
import uk.gov.justice.digital.hmpps.resourceloader.ResourceLoader

object MessageGenerator {
val EXAMPLE = ResourceLoader.message<HmppsDomainEvent>("example-message")
val COMMON_PLATFORM_EVENT = ResourceLoader.message<CommonPlatformHearing>("common-platform-hearing")
val COMMON_PLATFORM_EVENT_DOB_ERROR =
ResourceLoader.message<CommonPlatformHearing>("common-platform-hearing-dob-error")
val COMMON_PLATFORM_EVENT_NO_CASES =
ResourceLoader.message<CommonPlatformHearing>("common-platform-hearing-no-cases")
val COMMON_PLATFORM_EVENT_BLANK_ADDRESS =
ResourceLoader.message<CommonPlatformHearing>("common-platform-hearing-blank-address")
val COMMON_PLATFORM_EVENT_NO_REMAND =
ResourceLoader.message<CommonPlatformHearing>("common-platform-hearing-no-remand")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package uk.gov.justice.digital.hmpps.data.generator

import uk.gov.justice.digital.hmpps.integrations.delius.entity.Person
import uk.gov.justice.digital.hmpps.integrations.delius.person.entity.PersonAddress
import java.time.LocalDate

object PersonAddressGenerator {
val MAIN_ADDRESS = generate(person = PersonGenerator.DEFAULT)

fun generate(
id: Long? = IdGenerator.getAndIncrement(),
person: Person,
notes: String? = null,
postcode: String? = null,
) = PersonAddress(
id = id,
start = LocalDate.now(),
status = ReferenceDataGenerator.MAIN_ADDRESS_STATUS,
person = person,
notes = notes,
postcode = postcode,
type = ReferenceDataGenerator.AWAITING_ASSESSMENT
)
}
Loading

0 comments on commit 3bbdaf5

Please sign in to comment.