}
@Override
public RestNode getNodeById(long id, Load force) {
if (force != Load.ForceFromServer) {
RestNode restNode = entityCache.getNode(id);
if (restNode != null) return restNode;
}
if (force == Load.FromCache) return new RestNode(RestNode.nodeUri(this, id),this);
// BatchRestAPI batchRestAPI = new BatchRestAPI(this);
// RestNode node = batchRestAPI.getNodeById(id);
RequestResult response = restRequest.get("node/" + id);
if (response.statusIs(Status.NOT_FOUND)) {
throw new NotFoundException("" + id);
}
RestNode node;
Map<String, Object> data = (Map<String, Object>) response.toMap();
if (response.isMap() && data.containsKey("metadata")) {
node = new RestNode(data, this);
} else {
Collection<String> labels = getNodeLabels(id);
node = new RestNode(id, labels, data, this);
}
return entityCache.addToCache(node);
}