public interface EntityService<E extends Entity>
Provides generic access to an entity service.
Modifier and Type | Method and Description |
---|---|
long |
countEntities(Predicate predicate)
Counts the entities that match the query with the given predicate.
|
long |
countEntities(Predicate predicate,
SearchScope searchScope)
Counts the entities that match the query with the given predicate in the given scope.
|
long |
countEntities(Query entityQuery)
Counts the entities that match the given query.
|
long |
countEntities(Query entityQuery,
SearchScope searchScope)
Counts the entities that match the given query in the given scope.
|
String |
create(E template)
Creates a new root entity based on the given template.
|
String |
create(E template,
String parentId)
Creates a new child entity based on the given template.
|
List<E> |
findEntities(Predicate predicate)
Finds the entities that match the query with the given predicate.
|
List<E> |
findEntities(Predicate predicate,
SearchScope searchScope)
Finds the entities that match the query with the given predicate in the given scope.
|
List<E> |
findEntities(Query entityQuery)
Finds the entities that match the given query.
|
List<E> |
findEntities(Query entityQuery,
SearchScope searchScope)
Finds the entities that match the given query in the given scope.
|
E |
findEntity(Predicate predicate)
Finds the entity that matches the query with the given predicate.
|
E |
findEntity(Predicate predicate,
SearchScope searchScope)
Finds the entity that matches the query with the given predicate in the given scope.
|
E |
findEntity(Query entityQuery)
Finds the entity that matches the given query.
|
E |
findEntity(Query entityQuery,
SearchScope searchScope)
Finds the entity that matches the given query in the given scope.
|
E |
findEntityByExternalId(String externalId)
Finds the entity with the given external entity id.
|
E |
findEntityByExternalId(String externalId,
SearchScope searchScope)
Finds the entity with the given external entity id in the given scope.
|
E |
findEntityByGlobalId(String globalId)
Finds the entity with the given global id.
|
E |
findEntityByGlobalId(String globalId,
SearchScope searchScope)
Finds the entity with the given entity global id in the given scope.
|
E |
findEntityById(String id)
Finds the entity with the given entity id.
|
E |
findEntityById(String id,
SearchScope searchScope)
Finds the entity with the given entity id in the given scope.
|
String |
findIdByExternalId(String externalId)
Returns the id of the entity with the given external id.
|
String |
findIdByExternalId(String externalId,
SearchScope searchScope)
Returns the id of the entity with the given external id in the given scope.
|
E |
getEntityByGlobalId(String globalId)
Finds the entity with the given entity id.
|
E |
getEntityByGlobalId(String globalId,
SearchScope searchScope)
Finds the entity with the given entity id in the given scope.
|
E |
getEntityById(String entityId)
Finds the entity with the given entity id.
|
E |
getEntityById(String entityId,
SearchScope searchScope)
Finds the entity with the given entity id in the given scope.
|
String findIdByExternalId(String externalId)
Returns the id of the entity with the given external id.
externalId
- the external id of the entityString findIdByExternalId(String externalId, SearchScope searchScope)
Returns the id of the entity with the given external id in the given scope.
externalId
- the external id of the entitysearchScope
- the scope in which to search for the idE getEntityById(String entityId)
Finds the entity with the given entity id. If no entity matches the given id, an exception is thrown.
entityId
- the id of the entity to findEntityNotFoundException
- if entity cannot be foundE getEntityById(String entityId, SearchScope searchScope)
Finds the entity with the given entity id in the given scope. If no entity matches the given id, an exception is thrown.
entityId
- the id of the entity to findsearchScope
- the scope in which to search for the entityEntityNotFoundException
- if entity cannot be foundE getEntityByGlobalId(String globalId)
Finds the entity with the given entity id. If no entity matches the given id, an exception is thrown.
globalId
- the global id of the entity to findEntityNotFoundException
- if entity cannot be foundE getEntityByGlobalId(String globalId, SearchScope searchScope)
Finds the entity with the given entity id in the given scope. If no entity matches the given id, an exception is thrown.
globalId
- the global id of the entity to findsearchScope
- the scope in which to search for the entityEntityNotFoundException
- if entity cannot be foundE findEntityById(String id)
Finds the entity with the given entity id. If no entity matches the given id, null is returned.
id
- the id of the entity to findE findEntityById(String id, SearchScope searchScope)
Finds the entity with the given entity id in the given scope. If no entity matches the given id, null is returned.
id
- the id of the entity to findsearchScope
- the scope in which to search for the entityE findEntityByGlobalId(String globalId)
Finds the entity with the given global id. If no entity matches the given global id, null is returned.
globalId
- the global id of the entity to findE findEntityByGlobalId(String globalId, SearchScope searchScope)
Finds the entity with the given entity global id in the given scope. If no entity matches the given global id, null is returned.
globalId
- the global id of the entity to findsearchScope
- the scope in which to search for the entity (all-tenant scopes are not supported)E findEntityByExternalId(String externalId)
Finds the entity with the given external entity id. If no entity matches the given external id, null is returned.
externalId
- the external id of the entity to findE findEntityByExternalId(String externalId, SearchScope searchScope)
Finds the entity with the given external entity id in the given scope. If no entity matches the given external id, null is returned.
externalId
- the external id of the entity to findsearchScope
- the scope in which to search for the entityE findEntity(Predicate predicate)
Finds the entity that matches the query with the given predicate. If no entity matches the query with the given predicate, null is returned. If more than one entity matches the query with the predicate, an exception is thrown. <p> Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the queryE findEntity(Predicate predicate, SearchScope searchScope)
Finds the entity that matches the query with the given predicate in the given scope. If no entity matches the query with the given predicate, null is returned. If more than one entity matches the query with the predicate, an exception is thrown. <p> Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to search for the entityList<E> findEntities(Predicate predicate)
Finds the entities that match the query with the given predicate. If no entity matches the query with the given predicate, an empty list is returned. <p> Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the queryList<E> findEntities(Predicate predicate, SearchScope searchScope)
Finds the entities that match the query with the given predicate in the given scope. If no entity matches the query with the given predicate, an empty list is returned. <p> Note: No sorting, paging, nor query hints are applied. This can become a potential query performance issue.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to search for the entitieslong countEntities(Predicate predicate)
Counts the entities that match the query with the given predicate.
predicate
- the predicate to apply when executing the querylong countEntities(Predicate predicate, SearchScope searchScope)
Counts the entities that match the query with the given predicate in the given scope.
predicate
- the predicate to apply when executing the querysearchScope
- the scope in which to count the number of entitiesE findEntity(Query entityQuery)
Finds the entity that matches the given query. If no entity matches the given query, null is returned. If more than one entity matches the query, an exception is thrown.
entityQuery
- the query to executeE findEntity(Query entityQuery, SearchScope searchScope)
Finds the entity that matches the given query in the given scope. If no entity matches the given query, null is returned. If more than one entity matches the query, an exception is thrown.
entityQuery
- the query to executesearchScope
- the scope in which to search for the entityList<E> findEntities(Query entityQuery)
Finds the entities that match the given query. If no entity matches the given query, an empty list is returned.
entityQuery
- the query to executeList<E> findEntities(Query entityQuery, SearchScope searchScope)
Finds the entities that match the given query in the given scope. If no entity matches the given query, an empty list is returned.
entityQuery
- the query to executesearchScope
- the scope in which to search for the entitieslong countEntities(Query entityQuery)
Counts the entities that match the given query.
entityQuery
- the query to executelong countEntities(Query entityQuery, SearchScope searchScope)
Counts the entities that match the given query in the given scope.
entityQuery
- the query to executesearchScope
- the scope in which to count number of entitiesString create(E template)
Creates a new root entity based on the given template.
A provider will be used to manage the entity creation if one of the following conditions are met:
if the template has a valid definition ID, then the provider responsible for the definition is used
if the template has a valid provider ID, then the corresponding to the provider id is used
if the template has both a valid definition ID and a valid provider ID and they refer to the same provider then the corresponding provider will be used
If the definition ID and provider ID are both set but they refer to different providers then an
IllegalArgumentException
will be thrown.
If neither the definition ID or provider ID is set then the entity will simply be persisted without a provider being notified.
template
- the entity templateIllegalArgumentException
- if inconsistent provider information is suppliedString create(E template, String parentId)
Creates a new child entity based on the given template.
A provider will be used to manage the entity creation if one of the following conditions are met:
if the template has a valid definition ID, then the provider responsible for the definition is used
if the template has a valid provider ID, then the corresponding to the provider id is used
if the template has both a valid definition ID and a valid provider ID and they refer to the same provider then the corresponding provider will be used
If the definition ID and provider ID are both set but they refer to different providers then an
IllegalArgumentException
will be thrown.
If neither the definition ID or provider ID is set then the entity will simply be persisted without a provider being notified.
template
- the entity templateparentId
- the parent entity IDIllegalArgumentException
- if inconsistent provider information is suppliedCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.