use of uk.gov.gchq.gaffer.store.operation.util.StreamTransformIterable in project Gaffer by gchq.
the class TransformHandler method doOperation.
public Iterable<? extends Element> doOperation(final Transform operation, final Schema schema) throws OperationException {
if (null == operation.getInput()) {
throw new OperationException("Transform 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, ElementTransformer> entityMap = new HashMap<>();
schema.getEntityGroups().forEach(e -> entityMap.put(e, new ElementTransformer()));
operation.setEntities(entityMap);
final Map<String, ElementTransformer> edgeMap = new HashMap<>();
schema.getEdgeGroups().forEach(e -> edgeMap.put(e, new ElementTransformer()));
operation.setEdges(edgeMap);
}
final ValidationResult result = validator.validate(operation, schema);
if (!result.isValid()) {
throw new OperationException("Transform operation is invalid. " + result.getErrorString());
}
return new StreamTransformIterable(operation);
}
Aggregations