Interface EntityRepository<T extends AbstractEntity>
- Type Parameters:
T- the type of entity that extends AbstractEntity
public interface EntityRepository<T extends AbstractEntity>
The interface of generic repository for entities. It defines the basic CRUD operations.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteById(EntityRepositoryContext context, String id) Deletes an entity by its id.default List<OavDescriptor> describeOavs(Class<? extends AbstractEntity> entityClass) find(EntityRepositoryContext context) Reads a list of entitiesfindById(EntityRepositoryContext context, String id) Reads a single entity by its id.save(EntityRepositoryContext context, T entity) Creates a new entity and returns the created entity with its generated id.updateById(EntityRepositoryContext context, String id, T entity) Updates an existing entity and returns the updated entity.
-
Method Details
-
find
Reads a list of entities- Throws:
UnsupportedOperationException
-
findById
Reads a single entity by its id.- Throws:
UnsupportedOperationException
-
save
Creates a new entity and returns the created entity with its generated id.- Throws:
UnsupportedOperationException
-
deleteById
Deletes an entity by its id.- Throws:
UnsupportedOperationException
-
updateById
T updateById(EntityRepositoryContext context, String id, T entity) throws UnsupportedOperationException Updates an existing entity and returns the updated entity.- Throws:
UnsupportedOperationException
-
describeOavs
Returns the OAV metadata descriptors for the given entity class, derived purely from theSmeupOavandIdannotations on its declared fields.This is a default method so that concrete repositories (e.g.
AhdRepository,ContactCollaboratorRepository) get it for free without any boilerplate.- Parameters:
entityClass- the concrete entity class to introspect- Returns:
- an ordered list of
OavDescriptormatching field declaration order
-