Search in sources :

Example 11 with QueryEntry

use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.

the class PagingPredicateTest method pagingPredicateWithEmployeeObjectTest.

@SuppressWarnings({ "SameParameterValue", "unchecked" })
private List<Employee> pagingPredicateWithEmployeeObjectTest(IMap<Integer, Employee> map, Predicate<Integer, Employee> predicate, int pageSize) {
    PagingPredicate<Integer, Employee> pagingPredicate = Predicates.pagingPredicate(predicate, pageSize);
    Set<Map.Entry<Integer, Employee>> set;
    List<Employee> results = new ArrayList<>();
    do {
        set = map.entrySet(pagingPredicate);
        for (Map.Entry<Integer, Employee> entry : set) {
            Employee e = entry.getValue();
            InternalSerializationService ss = (InternalSerializationService) serializationService;
            QueryEntry qe = new QueryEntry(ss, ss.toData(e.getId()), e, Extractors.newBuilder(ss).build());
            assertTrue(predicate.apply(qe));
            results.add(e);
        }
        pagingPredicate.nextPage();
    } while (!set.isEmpty());
    return results;
}
Also used : QueryEntry(com.hazelcast.query.impl.QueryEntry) QueryEntry(com.hazelcast.query.impl.QueryEntry) ArrayList(java.util.ArrayList) InternalSerializationService(com.hazelcast.internal.serialization.InternalSerializationService) Map(java.util.Map)

Aggregations

QueryEntry (com.hazelcast.query.impl.QueryEntry)11 Data (com.hazelcast.internal.serialization.Data)5 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)4 EventData (com.hazelcast.map.impl.event.EventData)4 Map (java.util.Map)4 LocalEntryEventData (com.hazelcast.map.impl.querycache.event.LocalEntryEventData)3 CachedQueryEntry (com.hazelcast.query.impl.CachedQueryEntry)3 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)3 TrueEventFilter (com.hazelcast.spi.impl.eventservice.impl.TrueEventFilter)3 IMap (com.hazelcast.core.IMap)2 LocalCacheWideEventData (com.hazelcast.map.impl.querycache.event.LocalCacheWideEventData)2 QueryCacheRecord (com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord)2 Data (com.hazelcast.nio.serialization.Data)2 ArrayList (java.util.ArrayList)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 IndexConfig (com.hazelcast.config.IndexConfig)1 SerializationService (com.hazelcast.internal.serialization.SerializationService)1 IMap (com.hazelcast.map.IMap)1 EntryEventData (com.hazelcast.map.impl.event.EntryEventData)1 MapEventData (com.hazelcast.map.impl.event.MapEventData)1