public interface CRUDService<T>
CRUDService interface.
Modifier and Type | Method and Description |
---|---|
long |
count()
Returns the number of entities available.
|
void |
delete(String id)
Deletes the entity with the given id.
|
void |
deleteAll()
Deletes all entities managed by the repository.
|
boolean |
exists(String id)
Returns whether an entity with the given id exists.
|
Iterable<T> |
findAll()
Returns all instances of the type.
|
Iterable<T> |
findAll(int page,
int size)
Returns all instances of the given page.
|
T |
findOne(String id)
Retrieves an entity by its id.
|
<S extends T> |
update(S entity)
Updates an existing entity.
|
<S extends T> |
updateOrCreate(S entity)
Saves a given entity (creates it if it doesn't exist).
|
T findOne(String id) throws EntityNotFoundException
id
- must not be null.IllegalArgumentException
- if id
is nullEntityNotFoundException
- in case there is no entity with the given id
<S extends T> S update(S entity) throws EntityNotFoundException
S
- a S object.entity
- the entity to updateEntityNotFoundException
- in case there is no entity with the given id
<S extends T> S updateOrCreate(S entity)
S
- a S object.entity
- the entity to updateboolean exists(String id)
id
- must not be null.IllegalArgumentException
- if id
is nullIterable<T> findAll(int page, int size)
page
will return the first
page.page
- a int.size
- a int.long count()
void delete(String id) throws EntityNotFoundException
id
- must not be null.IllegalArgumentException
- in case the given id
is nullEntityNotFoundException
- in case there is no entity with the given id
void deleteAll()
Copyright © 2011–2016 eXo Platform SAS. All rights reserved.