use of uk.gov.gchq.gaffer.operation.util.StreamFilterIterable in project Gaffer by gchq.
the class FilterHandler method doOperation.
public Iterable<? extends Element> doOperation(final Filter operation, final Schema schema) throws OperationException {
if (null == operation.getInput()) {
throw new OperationException("Filter operation has null iterable of elements");
}
// all elements should be used. This matches the way a View works.
if (null == operation.getEntities() && null == operation.getEdges()) {
final Map<String, ElementFilter> entityMap = new HashMap<>();
schema.getEntityGroups().forEach(e -> entityMap.put(e, new ElementFilter()));
operation.setEntities(entityMap);
final Map<String, ElementFilter> edgeMap = new HashMap<>();
schema.getEdgeGroups().forEach(e -> edgeMap.put(e, new ElementFilter()));
operation.setEdges(edgeMap);
}
final ValidationResult result = validator.validate(operation, schema);
if (!result.isValid()) {
throw new OperationException("Filter operation is invalid. " + result.getErrorString());
}
return new StreamFilterIterable(operation);
}
Aggregations