use of org.apache.apex.malhar.lib.appdata.schemas.SnapshotSchema in project apex-malhar by apache.
the class DataQuerySnapshotValidator method validate.
@Override
public boolean validate(Message query, Object context) {
DataQuerySnapshot gdqt = (DataQuerySnapshot) query;
SnapshotSchema schema = (SnapshotSchema) ((SchemaRegistry) context).getSchema(gdqt.getSchemaKeys());
Set<String> fields = schema.getValuesDescriptor().getFields().getFields();
if (!fields.containsAll(gdqt.getFields().getFields())) {
LOG.error("Some of the fields in the query {} are not one of the valid fields {}.", fields, gdqt.getFields().getFields());
return false;
}
if (gdqt.getFields().getFields().isEmpty()) {
gdqt.setFieldsVal(new Fields(fields));
}
return true;
}
Aggregations