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.
CAS-1178 - setup documents data for cas1 team (#4367)
- Loading branch information
1 parent
b2a4fb3
commit 9c4bad5
Showing
5 changed files
with
90 additions
and
17 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
54 changes: 54 additions & 0 deletions
54
...remises-and-delius/src/dev/kotlin/uk/gov/justice/digital/hmpps/data/DocumentDataLoader.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,54 @@ | ||
package uk.gov.justice.digital.hmpps.data | ||
|
||
import org.springframework.stereotype.Component | ||
import uk.gov.justice.digital.hmpps.data.generator.DocumentGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.ProbationCaseGenerator | ||
import uk.gov.justice.digital.hmpps.integrations.delius.approvedpremises.referral.entity.EventRepository | ||
import uk.gov.justice.digital.hmpps.integrations.delius.document.DocumentRepository | ||
import uk.gov.justice.digital.hmpps.integrations.delius.document.entity.DocumentType | ||
import uk.gov.justice.digital.hmpps.integrations.delius.person.PersonRepository | ||
import java.util.* | ||
|
||
@Component | ||
class DocumentDataLoader( | ||
private val personRepository: PersonRepository, | ||
private val documentRepository: DocumentRepository, | ||
private val eventRepository: EventRepository | ||
) { | ||
fun loadData() { | ||
documentRepository.save(DocumentGenerator.EVENT_DOC) | ||
documentRepository.save(DocumentGenerator.PERSON_DOC) | ||
|
||
val person = personRepository.findByCrnAndSoftDeletedIsFalse(ProbationCaseGenerator.CASE_X320741.crn)!! | ||
|
||
documentRepository.save( | ||
DocumentGenerator.generatePersonDoc( | ||
person = person, | ||
name = "Random offender document.pdf", | ||
alfrescoId = UUID.randomUUID().toString(), | ||
documentType = DocumentType.DOCUMENT | ||
) | ||
) | ||
|
||
val personEvent = PersonGenerator.generateEvent( | ||
"1", | ||
person.id | ||
).apply(eventRepository::save) | ||
|
||
listOf( | ||
Pair("CPS pack.pdf", DocumentType.CPS_PACK), | ||
Pair("Conviction document.pdf", DocumentType.PREVIOUS_CONVICTION) | ||
).forEach { | ||
documentRepository.save( | ||
DocumentGenerator.generateEventDoc( | ||
person = person, | ||
event = personEvent, | ||
name = it.first, | ||
alfrescoId = UUID.randomUUID().toString(), | ||
documentType = it.second, | ||
) | ||
) | ||
} | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
...pproved-premises-and-delius/src/dev/resources/simulations/mappings/alfresco_wildcard.json
Large diffs are not rendered by default.
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