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.void
delete()
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.T
first()
Get the first instance of an entity collection.Class<T>
getEntityClass()
EntityType
getEntityType()
SensorThingsService
getService()
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:QueryParameter
Add the filter parameter as specified by the SensorThingsAPI specification.- Specified by:
filter
in 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:QueryParameter
Add the top parameter as specified by the SensorThingsAPI specification.- Specified by:
top
in 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:QueryParameter
Add the orderBy parameter as specified by the SensorThingsAPI specification.- Specified by:
orderBy
in 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:QueryParameter
Add the skip parameter as specified by the SensorThingsAPI specification.- Specified by:
skip
in 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:QueryParameter
Add the count parameter as specified by the SensorThingsAPI specification.- Specified by:
count
in interfaceQueryParameter<T extends Entity<T>>
- Returns:
- the updated instance of the query
-
first
public T first() throws ServiceFailureException
Description copied from interface:QueryRequest
Get the first instance of an entity collection.- Specified by:
first
in 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:QueryRequest
Get an entity collection.- Specified by:
list
in interfaceQueryRequest<T extends Entity<T>>
- Returns:
- the entity collection
- Throws:
ServiceFailureException
- the request failed
-
delete
public void delete() throws ServiceFailureException
- Throws:
ServiceFailureException
-
-