use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements in project Gaffer by gchq.
the class ClassicIteratorSettingsFactory method getEdgeEntityDirectionFilterIteratorSetting.
@Override
public IteratorSetting getEdgeEntityDirectionFilterIteratorSetting(final GetElementsOperation<?, ?> operation) {
final boolean includeEntities = operation.isIncludeEntities();
final IncludeEdgeType includeEdgeType = operation.getIncludeEdges();
final IncludeIncomingOutgoingType includeIncomingOutgoingType = operation.getIncludeIncomingOutGoing();
final boolean deduplicateUndirectedEdges = operation instanceof GetAllElements;
if (includeIncomingOutgoingType == IncludeIncomingOutgoingType.BOTH && includeEdgeType == IncludeEdgeType.ALL && !deduplicateUndirectedEdges) {
return null;
}
return new IteratorSettingBuilder(AccumuloStoreConstants.EDGE_ENTITY_DIRECTED_UNDIRECTED_INCOMING_OUTGOING_FILTER_ITERATOR_PRIORITY, AccumuloStoreConstants.EDGE_ENTITY_DIRECTED_UNDIRECTED_INCOMING_OUTGOING_FILTER_ITERATOR_NAME, EDGE_DIRECTED_UNDIRECTED_FILTER).includeIncomingOutgoing(includeIncomingOutgoingType).includeEdges(includeEdgeType).includeEntities(includeEntities).deduplicateUndirectedEdges(deduplicateUndirectedEdges).build();
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements in project Gaffer by gchq.
the class OperationServiceIT method shouldReturnChunkedElements.
@Test
public void shouldReturnChunkedElements() throws IOException {
// Given
RestApiTestUtil.addElements(DEFAULT_ELEMENTS);
// When
final Response response = RestApiTestUtil.executeOperationChainChunked(new OperationChain<>(new GetAllElements<>()));
// Then
final List<Element> results = readChunkedElements(response);
verifyElements(DEFAULT_ELEMENTS, results);
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements in project Gaffer by gchq.
the class OperationServiceIT method shouldReturnNoChunkedElementsWhenNoElementsInGraph.
@Test
public void shouldReturnNoChunkedElementsWhenNoElementsInGraph() throws IOException {
// When
final Response response = RestApiTestUtil.executeOperationChainChunked(new OperationChain<>(new GetAllElements<>()));
// Then
final List<Element> results = readChunkedElements(response);
assertEquals(0, results.size());
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements in project Gaffer by gchq.
the class OperationServiceIT method shouldReturnGroupCounts.
@Test
public void shouldReturnGroupCounts() throws IOException {
// Given
RestApiTestUtil.addElements(DEFAULT_ELEMENTS);
// When
final Response response = RestApiTestUtil.executeOperationChainChunked(new OperationChain.Builder().first(new GetAllElements<>()).then(new CountGroups()).build());
// Then
final GroupCounts groupCounts = response.readEntity(new GenericType<GroupCounts>() {
});
verifyGroupCounts(groupCounts);
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements in project Gaffer by gchq.
the class CountGroupsIT method shouldCountGroupsOfElementsWhenMoreElementsThanLimit.
@Test
public void shouldCountGroupsOfElementsWhenMoreElementsThanLimit() throws OperationException, InterruptedException {
// Given
final User user = new User();
final int limit = 5;
final Entity entity = new Entity(TestGroups.ENTITY_2, VERTEX);
entity.putProperty(TestPropertyNames.INT, 100);
// When
final GroupCounts counts = graph.execute(new Builder().first(new GetAllElements<>()).then(new CountGroups(limit)).build(), user);
// Then
int totalCount = (null != counts.getEntityGroups().get(TestGroups.ENTITY) ? counts.getEntityGroups().get(TestGroups.ENTITY) : 0);
totalCount += (null != counts.getEdgeGroups().get(TestGroups.EDGE) ? counts.getEdgeGroups().get(TestGroups.EDGE) : 0);
assertEquals(limit, totalCount);
}
Aggregations