CRUDService

abstract class CRUDService<I : Serializable, E : CRUDEntity<I, E>, out M : CRUDModel<I>, in CM : CRUDCreateModel, in UM : CRUDUpdateModel, out Mapper : CRUDMapper<I, E, M, CM, UM>>(typeName: String, instantProvider: InstantProvider, repository: CRUDRepository<I, E>, mapper: Mapper)(source)

Base implementation of a CRUD service for business layer

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

Parameters

I

Id type of the data

M

Model type of the data which is a CRUDModel

E

Entity type of the data which is a CRUDEntity

CM

Create model type of the data which is a CRUDCreateModel

UM

Update model type of the data which is a CRUDUpdateModel

Mapper

Mapper type of the data which is a CRUDMapper

Constructors

Link copied to clipboard
fun <I : Serializable, E : CRUDEntity<I, E>, out Mapper : CRUDMapper<I, E, M, CM, UM>> CRUDService(typeName: String, instantProvider: InstantProvider, repository: CRUDRepository<I, E>, mapper: Mapper)

Functions

Link copied to clipboard
@Transactional
open fun create(createModel: CM): M

Default implementation for creating a new entity from given create model

Link copied to clipboard
@Transactional
open fun delete(id: I)

Default implementation for deleting an entity with given id

Link copied to clipboard
open fun get(id: I): M?

Default implementation for getting an entity with given id

Link copied to clipboard
open fun getAll(pageable: Pageable): Paged<M>

Default implementation for listing entities with given pagination

Link copied to clipboard
@Transactional
open fun update(id: I, updateModel: UM): M

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

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard