Search in sources :

Example 1 with IndexDefinitionRepresentation

use of org.neo4j.server.rest.repr.IndexDefinitionRepresentation in project neo4j by neo4j.

the class DatabaseActions method getSchemaIndexes.

public ListRepresentation getSchemaIndexes() {
    Iterable<IndexDefinition> definitions = graphDb.schema().getIndexes();
    Iterable<IndexDefinitionRepresentation> representations = map(new Function<IndexDefinition, IndexDefinitionRepresentation>() {

        @Override
        public IndexDefinitionRepresentation apply(IndexDefinition definition) {
            return new IndexDefinitionRepresentation(definition, graphDb.schema().getIndexState(definition), graphDb.schema().getIndexPopulationProgress(definition));
        }
    }, definitions);
    return new ListRepresentation(RepresentationType.INDEX_DEFINITION, representations);
}
Also used : IndexDefinition(org.neo4j.graphdb.schema.IndexDefinition) IndexDefinitionRepresentation(org.neo4j.server.rest.repr.IndexDefinitionRepresentation) ListRepresentation(org.neo4j.server.rest.repr.ListRepresentation)

Example 2 with IndexDefinitionRepresentation

use of org.neo4j.server.rest.repr.IndexDefinitionRepresentation in project neo4j by neo4j.

the class TransactionWrappedDatabaseActions method createSchemaIndex.

@Override
public IndexDefinitionRepresentation createSchemaIndex(String labelName, Iterable<String> propertyKey) {
    try (Transaction transaction = graph.beginTx()) {
        IndexDefinitionRepresentation indexDefinitionRepresentation = super.createSchemaIndex(labelName, propertyKey);
        transaction.success();
        return indexDefinitionRepresentation;
    }
}
Also used : Transaction(org.neo4j.graphdb.Transaction) IndexDefinitionRepresentation(org.neo4j.server.rest.repr.IndexDefinitionRepresentation)

Example 3 with IndexDefinitionRepresentation

use of org.neo4j.server.rest.repr.IndexDefinitionRepresentation in project neo4j by neo4j.

the class DatabaseActions method getSchemaIndexes.

public ListRepresentation getSchemaIndexes(String labelName) {
    Iterable<IndexDefinition> definitions = graphDb.schema().getIndexes(label(labelName));
    Iterable<IndexDefinitionRepresentation> representations = map(new Function<IndexDefinition, IndexDefinitionRepresentation>() {

        @Override
        public IndexDefinitionRepresentation apply(IndexDefinition definition) {
            return new IndexDefinitionRepresentation(definition, graphDb.schema().getIndexState(definition), graphDb.schema().getIndexPopulationProgress(definition));
        }
    }, definitions);
    return new ListRepresentation(RepresentationType.INDEX_DEFINITION, representations);
}
Also used : IndexDefinition(org.neo4j.graphdb.schema.IndexDefinition) IndexDefinitionRepresentation(org.neo4j.server.rest.repr.IndexDefinitionRepresentation) ListRepresentation(org.neo4j.server.rest.repr.ListRepresentation)

Aggregations

IndexDefinitionRepresentation (org.neo4j.server.rest.repr.IndexDefinitionRepresentation)3 IndexDefinition (org.neo4j.graphdb.schema.IndexDefinition)2 ListRepresentation (org.neo4j.server.rest.repr.ListRepresentation)2 Transaction (org.neo4j.graphdb.Transaction)1