Search in sources :

Example 11 with ListRepresentation

use of org.neo4j.server.rest.repr.ListRepresentation 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)

Example 12 with ListRepresentation

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

the class JmxCompositeDataRepresentation method getValue.

@Mapping("value")
public ListRepresentation getValue() {
    ArrayList<Representation> values = new ArrayList<Representation>();
    for (Object key : data.getCompositeType().keySet()) {
        String name = key.toString();
        String description = data.getCompositeType().getDescription(name);
        Representation value = REPRESENTATION_DISPATCHER.dispatch(data.get(name), "");
        values.add(new NameDescriptionValueRepresentation(name, description, value));
    }
    return new ListRepresentation("value", values);
}
Also used : ArrayList(java.util.ArrayList) ListRepresentation(org.neo4j.server.rest.repr.ListRepresentation) ValueRepresentation(org.neo4j.server.rest.repr.ValueRepresentation) Representation(org.neo4j.server.rest.repr.Representation) ObjectRepresentation(org.neo4j.server.rest.repr.ObjectRepresentation) ListRepresentation(org.neo4j.server.rest.repr.ListRepresentation)

Aggregations

ListRepresentation (org.neo4j.server.rest.repr.ListRepresentation)12 ArrayList (java.util.ArrayList)4 IndexDefinitionRepresentation (org.neo4j.server.rest.repr.IndexDefinitionRepresentation)4 Representation (org.neo4j.server.rest.repr.Representation)4 ValueRepresentation (org.neo4j.server.rest.repr.ValueRepresentation)4 MBeanServer (javax.management.MBeanServer)3 Path (javax.ws.rs.Path)3 IterableWrapper (org.neo4j.helpers.collection.IterableWrapper)3 PathRepresentation (org.neo4j.server.rest.repr.PathRepresentation)3 WeightedPathRepresentation (org.neo4j.server.rest.repr.WeightedPathRepresentation)3 ObjectName (javax.management.ObjectName)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 Node (org.neo4j.graphdb.Node)2 NotFoundException (org.neo4j.graphdb.NotFoundException)2 Transaction (org.neo4j.graphdb.Transaction)2 IndexDefinition (org.neo4j.graphdb.schema.IndexDefinition)2 EndNodeNotFoundException (org.neo4j.server.rest.domain.EndNodeNotFoundException)2 StartNodeNotFoundException (org.neo4j.server.rest.domain.StartNodeNotFoundException)2 JmxMBeanRepresentation (org.neo4j.server.rest.management.repr.JmxMBeanRepresentation)2