public abstract class BaseServiceAbstract<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,R extends BaseRepository<M,C,I,U>,I extends Comparable<? super I>,U> extends Object implements BaseService<M,C,D,I,U>
| Modifier and Type | Field and Description |
|---|---|
protected Class<C> |
criteriaClazz |
protected org.slf4j.Logger |
LOGGER |
protected Class<M> |
modelClazz |
protected R |
repository |
| Constructor and Description |
|---|
BaseServiceAbstract() |
| Modifier and Type | Method and Description |
|---|---|
long |
delete(C criteria,
U user) |
long |
delete(I id,
U user)
delete data with given id
|
long |
delete(List<I> ids,
U user) |
org.springframework.data.domain.Page<M> |
get(C criteria,
org.springframework.data.domain.Pageable pageable,
U user) |
List<M> |
get(C criteria,
U user)
get all data match with given
criteria |
M |
get(I id,
U user)
get by id
|
List<M> |
get(List<I> ids,
U user) |
List<M> |
getAll(U user) |
long |
getCount(C criteria,
U user) |
C |
getEmptyCriteria() |
M |
getEmptyModel() |
List<I> |
getIds(C criteria,
U user) |
org.slf4j.Logger |
getLogger() |
M |
getOne(C criteria,
U user) |
R |
getRepository() |
boolean |
isExist(C criteria,
U user) |
boolean |
isNotExist(C criteria,
U user) |
protected abstract M |
onSave(D dto,
U user)
converting dto to model for save
|
protected abstract M |
onUpdate(D dto,
M previousModel,
U user) |
protected org.springframework.data.domain.Page<M> |
paging(List<M> list,
org.springframework.data.domain.Pageable pageable,
LongSupplier supplier) |
protected void |
postDelete(M deletedModel,
U user)
execute after deleting data
|
protected M |
postFetch(M model,
U user) |
protected org.springframework.data.domain.Page<M> |
postFetch(org.springframework.data.domain.Page<M> page,
org.springframework.data.domain.Pageable pageable,
U user) |
protected void |
postSave(M savedModel,
D dto,
U user) |
protected void |
postUpdate(M updatedModel,
D dto,
U user) |
protected void |
preDelete(M model,
U user)
execute before deleting data
|
protected void |
preSave(D dto,
U user) |
protected void |
preUpdate(M previousModel,
D dto,
U user) |
M |
save(D dto,
U user)
save new data
|
List<M> |
save(List<D> dtos,
U user)
save new data
|
M |
update(I id,
D dto,
U user) |
protected final org.slf4j.Logger LOGGER
protected final Class<M extends BaseModelAbstract<I>> modelClazz
protected final Class<C extends BaseCriteriaAbstract<I>> criteriaClazz
public M getEmptyModel()
public C getEmptyCriteria()
@Transactional public long delete(I id, U user)
delete in interface BaseService<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,I extends Comparable<? super I>,U>id - identifier of data that must be delete@Transactional public M save(D dto, U user)
save in interface BaseService<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,I extends Comparable<? super I>,U>@Transactional public List<M> save(List<D> dtos, U user)
@Transactional public M update(I id, D dto, U user)
update in interface BaseService<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,I extends Comparable<? super I>,U>public R getRepository()
public org.slf4j.Logger getLogger()
public final org.springframework.data.domain.Page<M> get(C criteria, org.springframework.data.domain.Pageable pageable, U user)
get in interface BaseService<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,I extends Comparable<? super I>,U>protected org.springframework.data.domain.Page<M> postFetch(org.springframework.data.domain.Page<M> page, org.springframework.data.domain.Pageable pageable, U user)
public final M get(I id, U user)
get in interface BaseService<M extends BaseModelAbstract<I>,C extends BaseCriteriaAbstract<I>,D,I extends Comparable<? super I>,U>protected org.springframework.data.domain.Page<M> paging(List<M> list, org.springframework.data.domain.Pageable pageable, LongSupplier supplier)
Copyright © 2020. All rights reserved.