Package de.fraunhofer.iosb.ilt.sta.query
Class Query<T extends Entity<T>>
- java.lang.Object
-
- de.fraunhofer.iosb.ilt.sta.query.Query<T>
-
- Type Parameters:
T- The type of entity this query returns.
- All Implemented Interfaces:
QueryParameter<T>,QueryRequest<T>
public class Query<T extends Entity<T>> extends Object implements QueryRequest<T>, QueryParameter<T>
A query for reading operations.- Author:
- Nils Sommer, Hylke van der Schaaf
-
-
Constructor Summary
Constructors Constructor Description Query(SensorThingsService service, Class<T> entityClass)Query(SensorThingsService service, Class<T> entityClass, Entity<?> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Query<T>count()Add the count parameter as specified by the SensorThingsAPI specification.voiddelete()Query<T>expand(Expansion expansion)Query<T>expand(String expansion)Query<T>filter(String options)Add the filter parameter as specified by the SensorThingsAPI specification.Tfirst()Get the first instance of an entity collection.Class<T>getEntityClass()EntityTypegetEntityType()SensorThingsServicegetService()EntityList<T>list()Get an entity collection.Query<T>orderBy(String clause)Add the orderBy parameter as specified by the SensorThingsAPI specification.Query<T>select(String... fields)Query<T>skip(int n)Add the skip parameter as specified by the SensorThingsAPI specification.Query<T>top(int n)Add the top parameter as specified by the SensorThingsAPI specification.
-
-
-
Constructor Detail
-
Query
public Query(SensorThingsService service, Class<T> entityClass)
-
Query
public Query(SensorThingsService service, Class<T> entityClass, Entity<?> parent)
-
-
Method Detail
-
getEntityType
public EntityType getEntityType()
-
getService
public SensorThingsService getService()
-
filter
public Query<T> filter(String options)
Description copied from interface:QueryParameterAdd the filter parameter as specified by the SensorThingsAPI specification.- Specified by:
filterin interfaceQueryParameter<T extends Entity<T>>- Parameters:
options- the filter options as a string- Returns:
- the updated instance of the query
-
top
public Query<T> top(int n)
Description copied from interface:QueryParameterAdd the top parameter as specified by the SensorThingsAPI specification.- Specified by:
topin interfaceQueryParameter<T extends Entity<T>>- Parameters:
n- the limit- Returns:
- the updated instance of the query
-
orderBy
public Query<T> orderBy(String clause)
Description copied from interface:QueryParameterAdd the orderBy parameter as specified by the SensorThingsAPI specification.- Specified by:
orderByin interfaceQueryParameter<T extends Entity<T>>- Parameters:
clause- the order clause- Returns:
- the updated instance of the query
-
skip
public Query<T> skip(int n)
Description copied from interface:QueryParameterAdd the skip parameter as specified by the SensorThingsAPI specification.- Specified by:
skipin interfaceQueryParameter<T extends Entity<T>>- Parameters:
n- the number of entities to skip- Returns:
- the updated instance of the query
-
count
public Query<T> count()
Description copied from interface:QueryParameterAdd the count parameter as specified by the SensorThingsAPI specification.- Specified by:
countin interfaceQueryParameter<T extends Entity<T>>- Returns:
- the updated instance of the query
-
first
public T first() throws ServiceFailureException
Description copied from interface:QueryRequestGet the first instance of an entity collection.- Specified by:
firstin interfaceQueryRequest<T extends Entity<T>>- Returns:
- the first instance
- Throws:
ServiceFailureException- the request failed
-
list
public EntityList<T> list() throws ServiceFailureException
Description copied from interface:QueryRequestGet an entity collection.- Specified by:
listin interfaceQueryRequest<T extends Entity<T>>- Returns:
- the entity collection
- Throws:
ServiceFailureException- the request failed
-
delete
public void delete() throws ServiceFailureException- Throws:
ServiceFailureException
-
-