Package de.xima.fc.ms.test.dao
Interface DaoCrudMixin
- 
- All Known Implementing Classes:
 AEventRunnerTest,AWorkflowEngineTest
public interface DaoCrudMixinMixin to simplify CRUD (create-read-update-delete) operations on entities implemented via theDaoProviderlayer .- Since:
 - 8.0.0
 - Author:
 - XIMA MEDIA GmbH
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <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>dao(Class<T> entity)default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
IGenericDao<T>dao(T entity)default voiddelete(de.xima.cmn.dao.interfaces.IEntity<Long> entity)Delete the given entity.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
voiddelete(Class<T> type, long id)Deletes the entity with the given database ID.IEntityContextec()default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tread(Class<T> type, long id)Read the entity with the given database ID.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tread(Class<T> type, de.xima.cmn.criteria.FilterCriterion filters)Reads the entity with the given filter.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tread(T entity)Re-reads the given entity from the database.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.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Tupdate(T entity)Update the given existing entity.default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>,V>
Tupdate(T entity, BiConsumer<T,V> mutator, V value)Sets the value on the given entity, the updates it. 
 - 
 
- 
- 
Method Detail
- 
create
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T create(T entity)
Creates the given non-persisted entity.- Type Parameters:
 T- Type of the entity.- Parameters:
 entity- Entity to create.- Returns:
 - The created entity.
 
 
- 
createOrUpdate
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T createOrUpdate(T entity)
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
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> IGenericDao<T> dao(Class<T> entity)
- Type Parameters:
 T- Type of the entity.- Parameters:
 entity- An entity.- Returns:
 - A generic DAO for the given entity.
 
 
- 
dao
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> IGenericDao<T> dao(T entity)
- Type Parameters:
 T- Type of the entity.- Parameters:
 entity- Runtime type of the entity.- Returns:
 - A generic DAO for the given entity type.
 
 
- 
delete
default void delete(de.xima.cmn.dao.interfaces.IEntity<Long> entity)
Delete the given entity.- Parameters:
 entity- Entity to delete.
 
- 
delete
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> void delete(Class<T> type, long id)
Deletes the entity with the given database ID.- Type Parameters:
 T- Type of the entity.- Parameters:
 type- Type of the entity to delete.id-IDof the entity.
 
- 
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 
nullif no entity matches. - Throws:
 IllegalStateException- When more than one entity matches the given filters.- See Also:
 , for creating complex filters.
 
- 
read
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T read(Class<T> type, long id)
Read the entity with the given database ID.- Type Parameters:
 T- Type of the entity.- Parameters:
 type- Type of the entity to read.id-IDof the entity.- Returns:
 - The read entity, or 
nullif no such entity exists. 
 
- 
read
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T read(T entity)
Re-reads the given entity from the database.- Type Parameters:
 T- Type of the entity.- Parameters:
 entity- The entity to re-read.- Returns:
 - The read entity, or 
nullif no such entity exists anymore. 
 
- 
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:
 , for creating complex filters.
 
- 
update
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>> T update(T entity)
Update the given existing entity.- Type Parameters:
 T- Type of the entity.- Parameters:
 entity- Entity to update.- Returns:
 - The updated entity.
 
 
- 
update
default <T extends de.xima.cmn.dao.interfaces.IEntity<Long>,V> T update(T entity, BiConsumer<T,V> mutator, V value)
Sets the value on the given entity, the updates it.- Type Parameters:
 T- Type of the entity.V- Type of the value to set.- Parameters:
 entity- Entity to update.mutator- Mutator to set the value on the entity.value- Value to set.- Returns:
 - The updated entity.
 
 
 - 
 
 -