Search in sources :

Example 26 with IteratorSettingException

use of uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException in project Gaffer by gchq.

the class SummariseGroupOverRangesHandler method doOperation.

public CloseableIterable<? extends Element> doOperation(final SummariseGroupOverRanges operation, final User user, final AccumuloStore store) throws OperationException {
    final int numEdgeGroups = operation.getView().getEdgeGroups().size();
    final int numEntityGroups = operation.getView().getEntityGroups().size();
    if ((numEdgeGroups + numEntityGroups) != 1) {
        throw new OperationException("You may only set one Group in your view for this operation.");
    }
    final String columnFamily;
    if (numEdgeGroups == 1) {
        columnFamily = (String) operation.getView().getEdgeGroups().toArray()[0];
    } else {
        columnFamily = (String) operation.getView().getEntityGroups().toArray()[0];
    }
    final IteratorSettingFactory itrFactory = store.getKeyPackage().getIteratorFactory();
    try {
        return new AccumuloRangeIDRetriever<>(store, operation, user, itrFactory.getElementPreAggregationFilterIteratorSetting(operation.getView(), store), itrFactory.getElementPostAggregationFilterIteratorSetting(operation.getView(), store), itrFactory.getEdgeEntityDirectionFilterIteratorSetting(operation), itrFactory.getElementPropertyRangeQueryFilter(operation), itrFactory.getRowIDAggregatorIteratorSetting(store, columnFamily));
    } catch (final IteratorSettingException | StoreException e) {
        throw new OperationException("Failed to get elements", e);
    }
}
Also used : IteratorSettingFactory(uk.gov.gchq.gaffer.accumulostore.key.IteratorSettingFactory) AccumuloRangeIDRetriever(uk.gov.gchq.gaffer.accumulostore.retriever.impl.AccumuloRangeIDRetriever) IteratorSettingException(uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException) OperationException(uk.gov.gchq.gaffer.operation.OperationException) StoreException(uk.gov.gchq.gaffer.store.StoreException)

Aggregations

IteratorSettingException (uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException)26 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)16 User (uk.gov.gchq.gaffer.user.User)16 HashSet (java.util.HashSet)15 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)15 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)12 Element (uk.gov.gchq.gaffer.data.element.Element)10 StoreException (uk.gov.gchq.gaffer.store.StoreException)9 Edge (uk.gov.gchq.gaffer.data.element.Edge)7 ElementId (uk.gov.gchq.gaffer.data.element.id.ElementId)7 ElementSeed (uk.gov.gchq.gaffer.operation.data.ElementSeed)7 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)6 OperationException (uk.gov.gchq.gaffer.operation.OperationException)6 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)4 AccumuloException (org.apache.accumulo.core.client.AccumuloException)3 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)3 EdgeSeed (uk.gov.gchq.gaffer.operation.data.EdgeSeed)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Entry (java.util.Map.Entry)2 BatchWriter (org.apache.accumulo.core.client.BatchWriter)2