use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.
the class ReplicatedMapEventPublishingService method shouldPublish.
private boolean shouldPublish(Data key, Data oldValue, Data value, EntryEventType eventType, EventFilter filter) {
QueryEntry queryEntry = null;
if (filter instanceof ReplicatedQueryEventFilter) {
Data testValue;
if (eventType == REMOVED) {
testValue = oldValue;
} else {
testValue = value;
}
queryEntry = new QueryEntry(serializationService, key, testValue, extractors);
}
return filter == null || filter.eval(queryEntry != null ? queryEntry : key);
}
use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.
the class NodeQueryCacheEventService method canPassFilter.
private boolean canPassFilter(LocalEntryEventData localEntryEventData, EventFilter filter, Extractors extractors) {
if (filter == null || filter instanceof TrueEventFilter) {
return true;
}
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
SerializationService serializationService = nodeEngine.getSerializationService();
Data keyData = localEntryEventData.getKeyData();
Object value = getValueOrOldValue(localEntryEventData);
QueryableEntry entry = new QueryEntry(serializationService, keyData, value, extractors);
return filter.eval(entry);
}
use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.
the class DefaultQueryCacheRecordStore method saveIndex.
/**
* Same as {@link #saveIndex}
* with explicit {@link CachedQueryEntry} arguments for reuse, to avoid
* excessive litter when adding several entries in batch.
*/
private void saveIndex(Data keyData, QueryCacheRecord currentRecord, QueryCacheRecord oldRecord, CachedQueryEntry newEntry, CachedQueryEntry oldEntry) {
if (indexes.haveAtLeastOneIndex()) {
Object currentValue = currentRecord.getValue();
QueryEntry queryEntry = new QueryEntry(ss, keyData, currentValue, extractors);
Object oldValue = oldRecord == null ? null : oldRecord.getValue();
newEntry.init(keyData, currentValue);
oldEntry.init(keyData, oldValue);
indexes.putEntry(newEntry, oldEntry, queryEntry, Index.OperationSource.USER);
}
}
use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.
the class DefaultQueryCacheRecordStore method saveIndex.
private void saveIndex(Object queryCacheKey, QueryCacheRecord currentRecord, QueryCacheRecord oldRecord) {
if (indexes.haveAtLeastOneIndex()) {
Data keyData = ss.toData(queryCacheKey);
Object currentValue = currentRecord.getValue();
QueryEntry queryEntry = new QueryEntry(ss, keyData, currentValue, extractors);
Object oldValue = oldRecord == null ? null : oldRecord.getValue();
CachedQueryEntry newEntry = new CachedQueryEntry(ss, keyData, currentValue, extractors);
CachedQueryEntry oldEntry = new CachedQueryEntry(ss, keyData, oldValue, extractors);
indexes.putEntry(newEntry, oldEntry, queryEntry, Index.OperationSource.USER);
}
}
use of com.hazelcast.query.impl.QueryEntry in project hazelcast by hazelcast.
the class ClientQueryCacheEventService method canPassFilter.
private boolean canPassFilter(Object eventData, EventFilter filter, Extractors extractors) {
if (filter == null || filter instanceof TrueEventFilter) {
return true;
}
if (!(eventData instanceof LocalEntryEventData)) {
return true;
}
LocalEntryEventData localEntryEventData = (LocalEntryEventData) eventData;
if (localEntryEventData.getEventType() != EventLostEvent.EVENT_TYPE) {
Object value = getValueOrOldValue(localEntryEventData);
Data keyData = localEntryEventData.getKeyData();
QueryEntry entry = new QueryEntry(serializationService, keyData, value, extractors);
return filter.eval(entry);
}
return true;
}
Aggregations