use of org.locationtech.geowave.core.store.adapter.MapRowBuilder in project geowave by locationtech.
the class ExpressionQueryFilter method accept.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public boolean accept(final CommonIndexModel indexModel, final IndexedPersistenceEncoding<?> persistenceEncoding) {
if ((filter != null) && (indexModel != null) && (adapter != null) && (indexMapping != null)) {
final Map<String, Object> fieldValues = Maps.newHashMap();
if (!referencedFieldsInitialized) {
initReferencedFields();
}
final PersistentDataset<?> commonData = persistenceEncoding.getCommonData();
PersistentDataset<Object> adapterExtendedValues = null;
for (final String field : referencedFields) {
if (fieldValues.containsKey(field)) {
continue;
}
if (fieldToIndexFieldMap.containsKey(field)) {
final IndexFieldMapper<?, ?> mapper = fieldToIndexFieldMap.get(field);
final Object indexValue = commonData.getValue(mapper.indexFieldName());
((IndexFieldMapper) mapper).toAdapter(indexValue, new MapRowBuilder(fieldValues));
} else {
final Object value = commonData.getValue(field);
if (value != null) {
fieldValues.put(field, value);
} else {
if (adapterExtendedValues == null) {
adapterExtendedValues = new MultiFieldPersistentDataset<>();
if (persistenceEncoding instanceof AbstractAdapterPersistenceEncoding) {
((AbstractAdapterPersistenceEncoding) persistenceEncoding).convertUnknownValues(adapter, indexModel);
final PersistentDataset<Object> existingExtValues = ((AbstractAdapterPersistenceEncoding) persistenceEncoding).getAdapterExtendedData();
if (persistenceEncoding.isAsync()) {
return false;
}
if (existingExtValues != null) {
adapterExtendedValues.addValues(existingExtValues.getValues());
}
}
}
fieldValues.put(field, adapterExtendedValues.getValue(field));
}
}
}
return filter.evaluate(fieldValues);
}
return true;
}
Aggregations