Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Service
- class EntityService(
- private val entityRepository,
- private val entityHistoryRepository,
- private val currentUserService
- ) {
- @Transactional
- fun createEntity(/* ... */) {
- val entity = Entity(/* ... */)
- entityRepository.add(entity)
- entityHistoryRepository.addRecord(HistoryRecordType.Created, currentUserService.currentUser(), entity)
- }
- @Transactional
- fun updateEntity(/* ... */) {
- val entity = /* ... */
- entityRepository.update(entity)
- entityHistoryRepository.addRecord(HistoryRecordType.Updated, currentUserService.currentUser(), entity)
- }
- @Transactional
- fun deleteEntity(/* ... */) {
- entityRepository.delete(/* ... */)
- entityHistoryRepository.addRecord(HistoryRecordType.Deleted, currentUserService.currentUser(), entity)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement