Package de.xima.fc.ms.test.dao
Interface DaoCrudMixin
- All Known Implementing Classes:
AEventRunnerTest
,AWorkflowEngineTest
public interface DaoCrudMixin
Mixin to simplify CRUD (create-read-update-delete) operations on entities implemented via the
DaoProvider
layer .- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tcreate
(T entity) Creates the given non-persisted entity.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TcreateOrUpdate
(T entity) Creates the given entity if not yet persisted, or updates it otherwise.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
IGenericDao<T>default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
IGenericDao<T>dao
(T entity) default void
Delete the given entity.ec()
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TRead the entity with the given database ID.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
TReads the entity with the given filter.Reads the entity with the given filter.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
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.
-
dao
- Type Parameters:
T
- Type of the entity.- Parameters:
entity
- An entity.- Returns:
- A generic DAO for the given entity.
-
dao
- Type Parameters:
T
- Type of the entity.- Parameters:
entity
- Runtime type of the entity.- Returns:
- A generic DAO for the given entity type.
-
delete
Delete the given entity.- Parameters:
entity
- Entity to delete.
-
ec
IEntityContext ec()- Returns:
- The entity context to use for database operations.
-
read
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> 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 de.xima.cmn.dao.interfaces.IEntity<Long>> 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.
-