Package de.xima.fc.ms.test.dao
Interface ApiCrudMixin
public interface ApiCrudMixin
Mixin to simplify CRUD (create-read-update-delete) operations on entities implemented via the
Configuration.ApiProvider
layer .- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends ITransferableEntity>
Tcreate
(T entity) Creates the given non-persisted entity.default <T extends ITransferableEntity>
TcreateOrUpdate
(T entity) Creates the given entity if not yet persisted, or updates it otherwise.default void
delete
(ITransferableEntity entity) Delete the given entity.default <T extends ITransferableEntity>
TRead the entity with the given database ID.default <T extends ITransferableEntity>
TReads the entity with the given filter.default <T extends ITransferableEntity>
List<T>Reads the entity with the given filter.uc()
default <T extends ITransferableEntity>
Tupdate
(T entity) Update the given existing entity.
-
Method Details
-
create
Creates the given non-persisted entity.- Type Parameters:
T
- Type of the entity.- Parameters:
entity
- Entity to create.- Returns:
- The created entity.
-
createOrUpdate
Creates the given entity if not yet persisted, or updates it otherwise.- Type Parameters:
T
- Type of the entity.- Parameters:
entity
- Entity to create or update.- Returns:
- The created or updated entity.
-
delete
Delete the given entity.- Parameters:
entity
- Entity to delete.
-
uc
UserContext uc()- Returns:
- The user context to use for API operations.
-
read
default <T extends ITransferableEntity> T read(Class<T> type, de.xima.cmn.criteria.FilterCriterion filters) Reads the entity with the given filter.- Type Parameters:
T
- Type of the entity.- Parameters:
type
- Type of the entity to read.filters
- Filters to apply to the search for the entity.- Returns:
- The single entity matching the given filter, or
null
if no entity matches. - Throws:
IllegalStateException
- When more than one entity matches the given filters.- See Also:
-
FilterCriterionBuilder, for creating complex filters.
-
read
Read the entity with the given database ID.- Type Parameters:
T
- Type of the entity.- Parameters:
type
- Type of the entity to read.id
-ID
of the entity.- Returns:
- The read entity, or
null
if no such entity exists.
-
readAll
default <T extends ITransferableEntity> List<T> readAll(Class<T> type, de.xima.cmn.criteria.FilterCriterion filters) Reads the entity with the given filter.- Type Parameters:
T
- Type of the entity.- Parameters:
type
- Type of the entity to read.filters
- Filters to apply to the search for the entity.- Returns:
- A list of all entities matching the given filter.
- See Also:
-
FilterCriterionBuilder, for creating complex filters.
-
update
Update the given existing entity.- Type Parameters:
T
- Type of the entity.- Parameters:
entity
- Entity to update.- Returns:
- The updated entity.
-