use of org.neo4j.server.rest.repr.ListRepresentation in project neo4j by neo4j.
the class DatabaseActions method getIndexedNodes.
public ListRepresentation getIndexedNodes(String indexName, final String key, final String value) {
if (!graphDb.index().existsForNodes(indexName)) {
throw new NotFoundException();
}
Index<Node> index = graphDb.index().forNodes(indexName);
final IndexRepresentation indexRepresentation = new NodeIndexRepresentation(indexName);
final IndexHits<Node> indexHits = index.get(key, value);
final IterableWrapper<Representation, Node> results = new IterableWrapper<Representation, Node>(indexHits) {
@Override
protected Representation underlyingObjectToObject(Node node) {
return new IndexedEntityRepresentation(node, key, value, indexRepresentation);
}
};
return new ListRepresentation(RepresentationType.NODE, results);
}
use of org.neo4j.server.rest.repr.ListRepresentation in project neo4j by neo4j.
the class DatabaseActions method getIndexedRelationships.
public ListRepresentation getIndexedRelationships(String indexName, final String key, final String value) {
if (!graphDb.index().existsForRelationships(indexName)) {
throw new NotFoundException();
}
Index<Relationship> index = graphDb.index().forRelationships(indexName);
final IndexRepresentation indexRepresentation = new RelationshipIndexRepresentation(indexName);
IterableWrapper<Representation, Relationship> result = new IterableWrapper<Representation, Relationship>(index.get(key, value)) {
@Override
protected Representation underlyingObjectToObject(Relationship relationship) {
return new IndexedEntityRepresentation(relationship, key, value, indexRepresentation);
}
};
return new ListRepresentation(RepresentationType.RELATIONSHIP, result);
}
use of org.neo4j.server.rest.repr.ListRepresentation 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);
}
use of org.neo4j.server.rest.repr.ListRepresentation in project neo4j by neo4j.
the class TransactionWrappedDatabaseActions method getNodesWithLabel.
@Override
public ListRepresentation getNodesWithLabel(String labelName, Map<String, Object> properties) {
try (Transaction transaction = graph.beginTx()) {
ListRepresentation nodesWithLabel = super.getNodesWithLabel(labelName, properties);
transaction.success();
return nodesWithLabel;
}
}
use of org.neo4j.server.rest.repr.ListRepresentation in project neo4j by neo4j.
the class JmxService method listDomains.
@GET
@Path(DOMAINS_PATH)
public Response listDomains() throws NullPointerException {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ListRepresentation domains = ListRepresentation.strings(server.getDomains());
return output.ok(domains);
}
Aggregations