Package org.fiware.mintaka.persistence
Interface EntityRepository
- All Known Implementing Classes:
TimescaleBackedEntityRepository
public interface EntityRepository
Interface for entity retrieval
-
Method Summary
Modifier and TypeMethodDescriptionfindAttributeByEntityId
(String entityId, TimeQuery timeQuery, List<String> attributes, Integer limit, boolean backwards) Find all attributes of an entity in the define timeframefindAttributesByEntityIds
(List<String> entityIds, String timeQueryPart) Find all attributes for the given entities in that timequery.Retrieve the entity from the db.findEntityIdsAndTimeframesByQuery
(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm, int pageSize, Optional<String> anchor) Query for timeframe and entityIds where all query elements are fulfilled.findSubAttributeInstancesForAttributeAndEntity
(String entityId, String attributeInstanceId, int limit, boolean backwards) Return all sub attribute instances for the given attribute instancegetCount
(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm) Count the number of entityId results for the given querygetCreatedAtForAttribute
(String attributeId, String entityId, boolean isSubAttribute) Get the list of timestamps that have opMode "create" for the given attribute.getEntityIfExists
(String entityId) Return an entity in case there are any instances of the entity in timescale db.int
Get the limit to be used for the given configurationgetPaginationInfo
(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm, int pageSize, Optional<String> anchor) Get the pagination information for the given query.
-
Method Details
-
findById
Retrieve the entity from the db.- Parameters:
entityId
- id of the entity to retrieve- Returns:
- optional entity
-
findAttributeByEntityId
LimitableResult<List<Attribute>> findAttributeByEntityId(String entityId, TimeQuery timeQuery, List<String> attributes, Integer limit, boolean backwards) Find all attributes of an entity in the define timeframe- Parameters:
entityId
- id to get attributes fortimeQuery
- time related queryattributes
- the attributes to be included, if null or empty return all- Returns:
- list of attribute instances
-
getLimit
Get the limit to be used for the given configuration- Parameters:
entitiesNumber
- - entities to be returnedattributesNumber
- - attributes to be returned per entitylastN
- - number of last values to be returned- Returns:
- the limit to apply
-
findEntityIdsAndTimeframesByQuery
List<EntityIdTempResults> findEntityIdsAndTimeframesByQuery(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm, int pageSize, Optional<String> anchor) Query for timeframe and entityIds where all query elements are fulfilled.- Parameters:
idPattern
- pattern to check idstypes
- types to includetimeQuery
- timeframe definitiongeoQuery
- geo related queryqueryTerm
- ngsi query- Returns:
- the list of entityIds and there timeframes
-
getCount
Number getCount(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm) Count the number of entityId results for the given query- Parameters:
idPattern
- pattern to check idstypes
- types to includetimeQuery
- timeframe definitiongeoQuery
- geo related queryqueryTerm
- ngsi query- Returns:
- number of matching entities
-
getPaginationInfo
PaginationInformation getPaginationInfo(Optional<List<String>> idList, Optional<String> idPattern, List<String> types, TimeQuery timeQuery, Optional<GeoQuery> geoQuery, Optional<QueryTerm> queryTerm, int pageSize, Optional<String> anchor) Get the pagination information for the given query. -
findSubAttributeInstancesForAttributeAndEntity
List<SubAttribute> findSubAttributeInstancesForAttributeAndEntity(String entityId, String attributeInstanceId, int limit, boolean backwards) Return all sub attribute instances for the given attribute instance- Parameters:
entityId
- entity the attributes and subattributes are connected toattributeInstanceId
- id of the concrete attributelimit
- number of instances to be retrievedbackwards
- should the instances be retrieved in reversed order.- Returns:
- list of subattribute instances
-
findAttributesByEntityIds
Find all attributes for the given entities in that timequery.- Parameters:
entityIds
- entities to be associated with the attributestimeQueryPart
- timeframe to search for- Returns:
- list of attributes
-
getCreatedAtForAttribute
Get the list of timestamps that have opMode "create" for the given attribute.- Parameters:
attributeId
- id of the attribute to find the timestamps forentityId
- id of the entity that are connected with the attributeisSubAttribute
- is the requestend attribute an attribute or a subattribute- Returns:
- the list of timestamps
-
getEntityIfExists
Return an entity in case there are any instances of the entity in timescale db.- Parameters:
entityId
- id of the entity to check- Returns:
- NgsiEntity if one exists
-