Search in sources :

Example 1 with ValidatedElements

use of uk.gov.gchq.gaffer.store.ValidatedElements in project Gaffer by gchq.

the class AddElementsHandler method addElements.

private void addElements(final AddElements operation, final AccumuloStore store) throws OperationException {
    try {
        final Iterable<? extends Element> validatedElements;
        if (operation.isValidate()) {
            validatedElements = new ValidatedElements(operation.getInput(), store.getSchema(), operation.isSkipInvalidElements());
        } else {
            validatedElements = operation.getInput();
        }
        store.addElements(validatedElements);
    } catch (final StoreException e) {
        throw new OperationException("Failed to add elements", e);
    }
}
Also used : ValidatedElements(uk.gov.gchq.gaffer.store.ValidatedElements) OperationException(uk.gov.gchq.gaffer.operation.OperationException) StoreException(uk.gov.gchq.gaffer.store.StoreException)

Example 2 with ValidatedElements

use of uk.gov.gchq.gaffer.store.ValidatedElements in project Gaffer by gchq.

the class AddElementsHandler method doOperation.

@Override
public Void doOperation(final AddElements addElements, final Context context, final Store store) throws OperationException {
    Iterable<? extends Element> elements = addElements.getInput();
    if (addElements.isValidate()) {
        elements = new ValidatedElements(elements, store.getSchema(), addElements.isSkipInvalidElements());
    }
    addElements(elements, (MapStore) store);
    return null;
}
Also used : ValidatedElements(uk.gov.gchq.gaffer.store.ValidatedElements)

Aggregations

ValidatedElements (uk.gov.gchq.gaffer.store.ValidatedElements)2 OperationException (uk.gov.gchq.gaffer.operation.OperationException)1 StoreException (uk.gov.gchq.gaffer.store.StoreException)1