Search in sources :

Example 1 with ExampleDomainObject

use of uk.gov.gchq.gaffer.rest.example.ExampleDomainObject in project Gaffer by gchq.

the class ExamplesService method generateElements.

@Override
public GenerateElements generateElements() {
    final GenerateElements<ExampleDomainObject> op = new GenerateElements<>(new ExampleDomainObjectGenerator());
    final ArrayList<ExampleDomainObject> objs = new ArrayList<>();
    if (hasEntities()) {
        final SchemaElementDefinition entityDef = getSchema().getEntity(getAnEntityGroup());
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 1)));
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 2)));
    }
    if (hasEdges()) {
        final SchemaElementDefinition edgeDef = getSchema().getEdge(getAnEdgeGroup());
        objs.add(new ExampleDomainObject(getAnEdgeGroup(), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.SOURCE), 1), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.DESTINATION), 1), isAnEdgeDirected()));
    }
    op.setInput(objs);
    populateOperation(op);
    return op;
}
Also used : GenerateElements(uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements) ArrayList(java.util.ArrayList) ExampleDomainObjectGenerator(uk.gov.gchq.gaffer.rest.example.ExampleDomainObjectGenerator) ExampleDomainObject(uk.gov.gchq.gaffer.rest.example.ExampleDomainObject) SchemaElementDefinition(uk.gov.gchq.gaffer.store.schema.SchemaElementDefinition)

Example 2 with ExampleDomainObject

use of uk.gov.gchq.gaffer.rest.example.ExampleDomainObject in project Gaffer by gchq.

the class AbstractExamplesFactory method generateElements.

public GenerateElements generateElements() {
    final GenerateElements<ExampleDomainObject> op = new GenerateElements<>(new ExampleElementGenerator());
    final ArrayList<ExampleDomainObject> objs = new ArrayList<>();
    if (hasEntities()) {
        final SchemaElementDefinition entityDef = getSchema().getEntity(getAnEntityGroup());
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 1)));
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 2)));
    }
    if (hasEdges()) {
        final SchemaElementDefinition edgeDef = getSchema().getEdge(getAnEdgeGroup());
        objs.add(new ExampleDomainObject(getAnEdgeGroup(), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.SOURCE), 1), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.DESTINATION), 1), isAnEdgeDirected()));
    }
    op.setInput(objs);
    populateOperation(op);
    return op;
}
Also used : ExampleElementGenerator(uk.gov.gchq.gaffer.rest.example.ExampleElementGenerator) GenerateElements(uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements) ArrayList(java.util.ArrayList) ExampleDomainObject(uk.gov.gchq.gaffer.rest.example.ExampleDomainObject) SchemaElementDefinition(uk.gov.gchq.gaffer.store.schema.SchemaElementDefinition)

Example 3 with ExampleDomainObject

use of uk.gov.gchq.gaffer.rest.example.ExampleDomainObject in project Gaffer by gchq.

the class ExamplesService method generateObjects.

@Override
public GenerateObjects generateObjects() {
    final GenerateObjects<Element, ExampleDomainObject> op = new GenerateObjects<>(new ExampleDomainObjectGenerator());
    List<Element> elements = new ArrayList<>();
    if (hasEntities()) {
        elements.add(getEntity(1));
        elements.add(getEntity(2));
    }
    if (hasEdges()) {
        elements.add(getEdge(1, 2));
    }
    op.setInput(elements);
    populateOperation(op);
    return op;
}
Also used : GenerateObjects(uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects) Element(uk.gov.gchq.gaffer.data.element.Element) ArrayList(java.util.ArrayList) ExampleDomainObjectGenerator(uk.gov.gchq.gaffer.rest.example.ExampleDomainObjectGenerator) ExampleDomainObject(uk.gov.gchq.gaffer.rest.example.ExampleDomainObject)

Example 4 with ExampleDomainObject

use of uk.gov.gchq.gaffer.rest.example.ExampleDomainObject in project Gaffer by gchq.

the class ExamplesService method generateObjects.

@Override
public GenerateObjects generateObjects() {
    final GenerateObjects<ExampleDomainObject> op = new GenerateObjects<>(new ExampleDomainObjectGenerator());
    List<Element> elements = new ArrayList<>();
    if (hasEntities()) {
        elements.add(getEntity(1));
        elements.add(getEntity(2));
    }
    if (hasEdges()) {
        elements.add(getEdge(1, 2));
    }
    op.setInput(elements);
    populateOperation(op);
    return op;
}
Also used : GenerateObjects(uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects) Element(uk.gov.gchq.gaffer.data.element.Element) ArrayList(java.util.ArrayList) ExampleDomainObjectGenerator(uk.gov.gchq.gaffer.rest.example.ExampleDomainObjectGenerator) ExampleDomainObject(uk.gov.gchq.gaffer.rest.example.ExampleDomainObject)

Example 5 with ExampleDomainObject

use of uk.gov.gchq.gaffer.rest.example.ExampleDomainObject in project Gaffer by gchq.

the class ExamplesService method generateElements.

@Override
public GenerateElements generateElements() {
    final GenerateElements<ExampleDomainObject> op = new GenerateElements<>(new ExampleElementGenerator());
    final ArrayList<ExampleDomainObject> objs = new ArrayList<>();
    if (hasEntities()) {
        final SchemaElementDefinition entityDef = getSchema().getEntity(getAnEntityGroup());
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 1)));
        objs.add(new ExampleDomainObject(getAnEntityGroup(), getExampleVertex(entityDef.getIdentifierClass(IdentifierType.VERTEX), 2)));
    }
    if (hasEdges()) {
        final SchemaElementDefinition edgeDef = getSchema().getEdge(getAnEdgeGroup());
        objs.add(new ExampleDomainObject(getAnEdgeGroup(), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.SOURCE), 1), getExampleVertex(edgeDef.getIdentifierClass(IdentifierType.DESTINATION), 1), isAnEdgeDirected()));
    }
    op.setInput(objs);
    populateOperation(op);
    return op;
}
Also used : ExampleElementGenerator(uk.gov.gchq.gaffer.rest.example.ExampleElementGenerator) GenerateElements(uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements) ArrayList(java.util.ArrayList) ExampleDomainObject(uk.gov.gchq.gaffer.rest.example.ExampleDomainObject) SchemaElementDefinition(uk.gov.gchq.gaffer.store.schema.SchemaElementDefinition)

Aggregations

ArrayList (java.util.ArrayList)6 ExampleDomainObject (uk.gov.gchq.gaffer.rest.example.ExampleDomainObject)6 ExampleDomainObjectGenerator (uk.gov.gchq.gaffer.rest.example.ExampleDomainObjectGenerator)4 Element (uk.gov.gchq.gaffer.data.element.Element)3 GenerateElements (uk.gov.gchq.gaffer.operation.impl.generate.GenerateElements)3 GenerateObjects (uk.gov.gchq.gaffer.operation.impl.generate.GenerateObjects)3 SchemaElementDefinition (uk.gov.gchq.gaffer.store.schema.SchemaElementDefinition)3 ExampleElementGenerator (uk.gov.gchq.gaffer.rest.example.ExampleElementGenerator)2