Search in sources :

Example 1 with NodeNodeMapper

use of org.structr.bolt.mapper.NodeNodeMapper in project structr by structr.

the class BoltDatabaseService method getNodesByLabel.

@Override
public QueryResult<Node> getNodesByLabel(final String type) {
    if (type == null) {
        return getAllNodes();
    }
    final StringBuilder buf = new StringBuilder();
    buf.append("MATCH (n");
    if (tenantId != null) {
        buf.append(":");
        buf.append(tenantId);
    }
    buf.append(":");
    buf.append(type);
    buf.append(") RETURN n");
    return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, new SimpleCypherQuery(buf.toString())));
}
Also used : NodeResultStream(org.structr.bolt.index.NodeResultStream) SimpleCypherQuery(org.structr.bolt.index.SimpleCypherQuery) NodeNodeMapper(org.structr.bolt.mapper.NodeNodeMapper)

Example 2 with NodeNodeMapper

use of org.structr.bolt.mapper.NodeNodeMapper in project structr by structr.

the class BoltDatabaseService method getNodesByTypeProperty.

@Override
public QueryResult<Node> getNodesByTypeProperty(final String type) {
    if (type == null) {
        return getAllNodes();
    }
    final StringBuilder buf = new StringBuilder();
    buf.append("MATCH (n");
    if (tenantId != null) {
        buf.append(":");
        buf.append(tenantId);
    }
    buf.append(") WHERE n.type = {type} RETURN n");
    final SimpleCypherQuery query = new SimpleCypherQuery(buf.toString());
    query.getParameters().put("type", type);
    // return QueryUtils.map(mapper, tx.getNodes("MATCH (n) WHERE n.type = {type} RETURN n", map));
    return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, query));
}
Also used : NodeResultStream(org.structr.bolt.index.NodeResultStream) SimpleCypherQuery(org.structr.bolt.index.SimpleCypherQuery) NodeNodeMapper(org.structr.bolt.mapper.NodeNodeMapper)

Example 3 with NodeNodeMapper

use of org.structr.bolt.mapper.NodeNodeMapper in project structr by structr.

the class BoltDatabaseService method getAllNodes.

@Override
public QueryResult<Node> getAllNodes() {
    final StringBuilder buf = new StringBuilder();
    buf.append("MATCH (n");
    if (tenantId != null) {
        buf.append(":");
        buf.append(tenantId);
    }
    buf.append(") RETURN n");
    return QueryUtils.map(new NodeNodeMapper(this), new NodeResultStream(this, new SimpleCypherQuery(buf.toString())));
}
Also used : NodeResultStream(org.structr.bolt.index.NodeResultStream) SimpleCypherQuery(org.structr.bolt.index.SimpleCypherQuery) NodeNodeMapper(org.structr.bolt.mapper.NodeNodeMapper)

Aggregations

NodeResultStream (org.structr.bolt.index.NodeResultStream)3 SimpleCypherQuery (org.structr.bolt.index.SimpleCypherQuery)3 NodeNodeMapper (org.structr.bolt.mapper.NodeNodeMapper)3