Search in sources :

Example 36 with EntityKey

use of org.thingsboard.server.common.data.query.EntityKey in project thingsboard by thingsboard.

the class BaseEntityServiceTest method createNumericKeyFilter.

private KeyFilter createNumericKeyFilter(String key, EntityKeyType keyType, NumericFilterPredicate.NumericOperation operation, double value) {
    KeyFilter filter = new KeyFilter();
    filter.setKey(new EntityKey(keyType, key));
    NumericFilterPredicate predicate = new NumericFilterPredicate();
    predicate.setValue(FilterPredicateValue.fromDouble(value));
    predicate.setOperation(operation);
    filter.setPredicate(predicate);
    return filter;
}
Also used : EntityKey(org.thingsboard.server.common.data.query.EntityKey) KeyFilter(org.thingsboard.server.common.data.query.KeyFilter) NumericFilterPredicate(org.thingsboard.server.common.data.query.NumericFilterPredicate)

Aggregations

EntityKey (org.thingsboard.server.common.data.query.EntityKey)36 EntityDataQuery (org.thingsboard.server.common.data.query.EntityDataQuery)24 EntityData (org.thingsboard.server.common.data.query.EntityData)23 Test (org.junit.Test)22 Device (org.thingsboard.server.common.data.Device)22 EntityDataPageLink (org.thingsboard.server.common.data.query.EntityDataPageLink)22 ArrayList (java.util.ArrayList)21 EntityDataSortOrder (org.thingsboard.server.common.data.query.EntityDataSortOrder)21 List (java.util.List)19 DeviceTypeFilter (org.thingsboard.server.common.data.query.DeviceTypeFilter)19 EntityKeyType (org.thingsboard.server.common.data.query.EntityKeyType)19 KeyFilter (org.thingsboard.server.common.data.query.KeyFilter)19 HashMap (java.util.HashMap)16 Map (java.util.Map)16 Collectors (java.util.stream.Collectors)16 EntityId (org.thingsboard.server.common.data.id.EntityId)15 LongDataEntry (org.thingsboard.server.common.data.kv.LongDataEntry)15 PageData (org.thingsboard.server.common.data.page.PageData)15 NumericFilterPredicate (org.thingsboard.server.common.data.query.NumericFilterPredicate)15 EntityType (org.thingsboard.server.common.data.EntityType)14