use of org.structr.bolt.SessionTransaction in project structr by structr.
the class RelationshipWrapper method newInstance.
public static RelationshipWrapper newInstance(final BoltDatabaseService db, final long id) {
synchronized (relationshipCache) {
RelationshipWrapper wrapper = relationshipCache.get(id);
if (wrapper == null) {
final SessionTransaction tx = db.getCurrentTransaction();
final Map<String, Object> map = new HashMap<>();
final StringBuilder buf = new StringBuilder();
final String tenantIdentifier = db.getTenantIdentifier();
map.put("id", id);
buf.append("MATCH (");
if (tenantIdentifier != null) {
buf.append(":");
buf.append(tenantIdentifier);
}
buf.append(")-[n]-(");
if (tenantIdentifier != null) {
buf.append(":");
buf.append(tenantIdentifier);
}
buf.append(") WHERE ID(n) = {id} RETURN n");
wrapper = new RelationshipWrapper(db, tx.getRelationship(buf.toString(), map));
relationshipCache.put(id, wrapper);
}
return wrapper;
}
}
use of org.structr.bolt.SessionTransaction in project structr by structr.
the class NodeResultStream method fetchData.
@Override
protected QueryResult<Node> fetchData(final BoltDatabaseService db, final String statement, final Map<String, Object> data) {
final SessionTransaction tx = db.getCurrentTransaction();
tx.setIsPing(getQuery().getQueryContext().isPing());
return tx.getNodes(statement, data);
}
Aggregations