Skip to content

Commit

Permalink
Merge branch 'dependabot/gradle/minor-4e1fa6339b' of github.com:minis…
Browse files Browse the repository at this point in the history
…tryofjustice/hmpps-probation-integration-services into dependabot/gradle/minor-4e1fa6339b
  • Loading branch information
achimber-moj committed Jan 6, 2025
2 parents 2c8650a + 315f102 commit 6276745
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ import uk.gov.justice.digital.hmpps.data.generator.ProviderGenerator
import uk.gov.justice.digital.hmpps.integrations.delius.provider.entity.Staff

@Component
class EntityManagerDataLoader{
class EntityManagerDataLoader {

@PersistenceContext
private lateinit var entityManager: EntityManager

@Transactional
fun loadData():Map<String, Staff> {
fun loadData(): Map<String, Staff> {

val staffMap = (PersonManagerGenerator.ALL.map { it.staff } + ProviderGenerator.UNALLOCATED_STAFF).associateBy { it.code }
val staffMap =
(PersonManagerGenerator.ALL.map { it.staff } + ProviderGenerator.UNALLOCATED_STAFF).associateBy { it.code }

val savedStaffMap = staffMap.map {
entityManager.merge(it.value)
}.associateBy { it.code }

return savedStaffMap

}

}

0 comments on commit 6276745

Please sign in to comment.