ID - the type of the primary key of the entityT - the type of the entitypublic interface BaseService<ID,T extends AbstractEntity<ID>>
| Modifier and Type | Method and Description |
|---|---|
long |
count()
Returns the total number of entities of this type
|
long |
count(Filter filter,
boolean distinct)
Returns the number of entities that match the provided filter
|
T |
createNewEntity()
Creates a new entity
|
void |
delete(List<T> list)
Deletes all entities in the provided list
|
void |
delete(T entity)
Deletes the provided entity
|
List<T> |
fetch(Filter filter,
FetchJoinInformation... joins)
Fetches entities that match the provided filter
|
List<T> |
fetch(Filter filter,
int pageNumber,
int pageSize,
FetchJoinInformation... joins)
Fetches a page of entities that match the provided filter
|
List<T> |
fetch(Filter filter,
int pageNumber,
int pageSize,
SortOrders sortOrders,
FetchJoinInformation... joins)
Fetches a page of entities that match the provided filter
|
List<T> |
fetch(Filter filter,
SortOrders orders,
FetchJoinInformation... joins)
Fetches entities that match the provided filter
|
T |
fetchById(ID id,
FetchJoinInformation... joins)
Fetches an entity (and its relations) based on its ID
|
List<T> |
fetchByIds(List<ID> ids,
FetchJoinInformation... joins)
Fetches the entities identified by the provided IDs
|
List<T> |
fetchByIds(List<ID> ids,
SortOrders sortOrders,
FetchJoinInformation... joins)
Fetches the entities identified by the provided IDs
|
T |
fetchByUniqueProperty(String propertyName,
Object value,
boolean caseSensitive,
FetchJoinInformation... joins)
Fetches an entity based on a unique property
|
List<T> |
find(Filter filter)
Returns all entities that match the provided filter
|
List<T> |
find(Filter filter,
SortOrder... orders)
Returns all entities that match the provided filter, sorted according to the provided sort
orders
|
List<T> |
findAll()
Returns a list of all entities.
|
List<T> |
findAll(SortOrder... sortOrders)
Returns a list of all entities, sorted according to the provided sort orders
|
T |
findById(ID id)
Finds an object based on its ID
|
T |
findByUniqueProperty(String propertyName,
Object value,
boolean caseSensitive)
Finds an object based on a unique property value
|
<S> List<S> |
findDistinct(Filter filter,
String distinctField,
Class<S> resultType,
SortOrder... orders)
Returns all distinct values that appear in a certain field for all entities that match the
provided filter
|
<S> List<S> |
findDistinctInCollectionTable(String tableName,
String distinctField,
Class<S> elementType)
Finds distinct elements in a collection table
|
List<ID> |
findIds(Filter filter,
SortOrder... orders)
Returns the IDS of the entities that match the provided filter
|
Class<T> |
getEntityClass()
Returns the class of the entity managed by this DAO
|
List<T> |
save(List<T> list)
Saves the provide list of entities
|
T |
save(T entity)
Saves the provided entity
|
void |
update(List<T> toUpdate,
List<T> toAdd,
List<T> toDelete)
Updates, adds, and deletes
|
long count()
long count(Filter filter, boolean distinct)
filter - the filterdistinct - whether to return only distinct resultsT createNewEntity()
void delete(List<T> list)
list - the list of entities to deletevoid delete(T entity)
entity - the entity to deleteList<T> fetch(Filter filter, FetchJoinInformation... joins)
filter - the filterjoins - the desired relations to fetchList<T> fetch(Filter filter, int pageNumber, int pageSize, FetchJoinInformation... joins)
filter - the filterpageNumber - the page number of the page to fetchpageSize - the page sizejoins - the desired relations to fetchList<T> fetch(Filter filter, int pageNumber, int pageSize, SortOrders sortOrders, FetchJoinInformation... joins)
filter - the filterpageNumber - the page number of the page to fetchpageSize - the page sizesortOrders - any sort orders to apply to the search resultsjoins - the desired relations to fetchList<T> fetch(Filter filter, SortOrders orders, FetchJoinInformation... joins)
filter - the filterpageable - the page infojoins - the desired relations to fetchT fetchById(ID id, FetchJoinInformation... joins)
id - the ID of the entityjoins - the desired relations to fetchList<T> fetchByIds(List<ID> ids, FetchJoinInformation... joins)
ids - the IDsjoins - desired relations to fetchList<T> fetchByIds(List<ID> ids, SortOrders sortOrders, FetchJoinInformation... joins)
ids - the IDs of the entities to fetchsort - the sort orderjoins - the desired relations to fetchT fetchByUniqueProperty(String propertyName, Object value, boolean caseSensitive, FetchJoinInformation... joins)
propertyName - the name of the propertyvalue - the value of the propertycaseSensitive - indicates whether the value is case sensitivejoins - the desired relations to fetchList<T> find(Filter filter)
filter - the filterList<T> find(Filter filter, SortOrder... orders)
filter - the filterorders - the sort orderList<T> findAll(SortOrder... sortOrders)
sort - the desired sort ordersT findById(ID id)
id - the IDnull if it cannot be foundT findByUniqueProperty(String propertyName, Object value, boolean caseSensitive)
propertyName - the name of the propertyvalue - the desired value of the propertycaseSensitive - whether the match is case sensitive<S> List<S> findDistinct(Filter filter, String distinctField, Class<S> resultType, SortOrder... orders)
filter - the filterdistinctField - the field used to remove duplicate rowsorders - the sort info<S> List<S> findDistinctInCollectionTable(String tableName, String distinctField, Class<S> elementType)
tableName - the name of the tabledistinctField - the name of the fieldelementType - the element typeList<ID> findIds(Filter filter, SortOrder... orders)
filter - the filtersort - the desired sortingClass<T> getEntityClass()
List<T> save(List<T> list)
list - the list of entitiesCopyright © 2017 Open Circle Solutions. All rights reserved.