Search in sources :

Example 1 with LazyEntity

use of uk.gov.gchq.gaffer.data.element.LazyEntity in project Gaffer by gchq.

the class AbstractElementFilter method accept.

@Override
public boolean accept(final Key key, final Value value) {
    final String group = elementConverter.getGroupFromColumnFamily(key.getColumnFamilyData().getBackingArray());
    if (groupsWithoutFilters.contains(group)) {
        return true;
    }
    final Element element;
    if (schema.isEntity(group)) {
        element = new LazyEntity(new Entity(group), new AccumuloEntityValueLoader(group, key, value, elementConverter, schema));
    } else {
        element = new LazyEdge(new Edge(group, null, null, false), new AccumuloEdgeValueLoader(group, key, value, elementConverter, schema, true));
    }
    return elementPredicate.test(element);
}
Also used : LazyEntity(uk.gov.gchq.gaffer.data.element.LazyEntity) Entity(uk.gov.gchq.gaffer.data.element.Entity) AccumuloEntityValueLoader(uk.gov.gchq.gaffer.accumulostore.data.element.AccumuloEntityValueLoader) Element(uk.gov.gchq.gaffer.data.element.Element) LazyEntity(uk.gov.gchq.gaffer.data.element.LazyEntity) AccumuloEdgeValueLoader(uk.gov.gchq.gaffer.accumulostore.data.element.AccumuloEdgeValueLoader) Edge(uk.gov.gchq.gaffer.data.element.Edge) LazyEdge(uk.gov.gchq.gaffer.data.element.LazyEdge) LazyEdge(uk.gov.gchq.gaffer.data.element.LazyEdge)

Example 2 with LazyEntity

use of uk.gov.gchq.gaffer.data.element.LazyEntity in project Gaffer by gchq.

the class StoreTest method shouldFullyLoadLazyElement.

@Test
public void shouldFullyLoadLazyElement() throws StoreException {
    // Given
    final StoreProperties properties = mock(StoreProperties.class);
    final LazyEntity lazyElement = mock(LazyEntity.class);
    final Entity entity = mock(Entity.class);
    final Store store = new StoreImpl();
    given(lazyElement.getGroup()).willReturn(TestGroups.ENTITY);
    given(lazyElement.getElement()).willReturn(entity);
    given(properties.getJobExecutorThreadCount()).willReturn(1);
    store.initialise("graphId", schema, properties);
    // When
    final Element result = store.populateElement(lazyElement);
    // Then
    assertSame(entity, result);
    verify(lazyElement).getGroup();
    verify(lazyElement).getProperty(TestPropertyNames.PROP_1);
    verify(lazyElement).getIdentifier(IdentifierType.VERTEX);
}
Also used : LazyEntity(uk.gov.gchq.gaffer.data.element.LazyEntity) Entity(uk.gov.gchq.gaffer.data.element.Entity) Element(uk.gov.gchq.gaffer.data.element.Element) LazyEntity(uk.gov.gchq.gaffer.data.element.LazyEntity) Test(org.junit.jupiter.api.Test)

Aggregations

Element (uk.gov.gchq.gaffer.data.element.Element)2 Entity (uk.gov.gchq.gaffer.data.element.Entity)2 LazyEntity (uk.gov.gchq.gaffer.data.element.LazyEntity)2 Test (org.junit.jupiter.api.Test)1 AccumuloEdgeValueLoader (uk.gov.gchq.gaffer.accumulostore.data.element.AccumuloEdgeValueLoader)1 AccumuloEntityValueLoader (uk.gov.gchq.gaffer.accumulostore.data.element.AccumuloEntityValueLoader)1 Edge (uk.gov.gchq.gaffer.data.element.Edge)1 LazyEdge (uk.gov.gchq.gaffer.data.element.LazyEdge)1