SimpleService

abstract class SimpleService<I : Serializable, E : SimpleEntity<I>, M : SimpleModel<I>, D : SimpleDTO<I>, out R : SimpleRepository<I, E>, out Mapper : SimpleMapper<I, E, M, D>>(val typeName: String, instantProvider: InstantProvider, repository: R, mapper: Mapper) : CRUDService<I, E, M, M, M, R, Mapper> (source)

Simple variant of CRUDService where create/update models are just models directly

This is meant to be extended from a @Service class.

Parameters

I

Id type of the data

E

Entity type of the data which is a SimpleEntity

M

Model type of the data which is a SimpleModel

D

DTO type of the data which is a SimpleDTO

R

Repository type of the data which is a SimpleRepository

Mapper

Mapper type of the data which is a SimpleMapper

Constructors

Link copied to clipboard
constructor(typeName: String, instantProvider: InstantProvider, repository: R, mapper: Mapper)

Properties

Link copied to clipboard
open override val typeName: String

Type name of the data this service manages

Inherited functions

Link copied to clipboard
@Transactional(rollbackFor = [Exception::class], isolation = Isolation.READ_COMMITTED)
open fun create(createModel: M, parameters: Parameters): M

Default implementation for creating a new entity from given create model

Link copied to clipboard
@Transactional(rollbackFor = [Exception::class], isolation = Isolation.READ_COMMITTED)
open fun delete(id: I, parameters: Parameters)

Default implementation for deleting an entity with given id

Link copied to clipboard
@Transactional(isolation = Isolation.REPEATABLE_READ, readOnly = true)
open fun get(id: I, parameters: Parameters): M?

Default implementation for getting an entity with given id

Link copied to clipboard
@Transactional(isolation = Isolation.REPEATABLE_READ, readOnly = true)
open fun list(pageable: Pageable, parameters: Parameters): Paged<M>

Default implementation for listing entities with given pagination

Link copied to clipboard
@Transactional(rollbackFor = [Exception::class], isolation = Isolation.READ_COMMITTED)
open fun update(id: I, updateModel: M, parameters: Parameters): M

Default implementation for updating an entity with given id with given update model data