use of org.neo4j.driver.exceptions.DatabaseException in project structr by structr.
the class AsyncSessionTransaction method run.
@Override
public Iterable<Map<String, Object>> run(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final ResultCursor cursor = resolveImmediately(tx.runAsync(statement, map));
final List<Record> records = resolveImmediately(cursor.listAsync());
return Iterables.map(new RecordMapMapper(db), records);
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw AsyncSessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw AsyncSessionTransaction.translateClientException(cex);
}
}
use of org.neo4j.driver.exceptions.DatabaseException in project structr by structr.
the class AsyncSessionTransaction method getRelationship.
@Override
public Relationship getRelationship(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final ResultCursor cursor = resolveImmediately(tx.runAsync(statement, map));
final CompletionStage<Record> peek = cursor.peekAsync();
final Record record = resolveImmediately(peek);
Relationship relationship = null;
if (record != null) {
relationship = record.get(0).asRelationship();
}
logSummary(resolveImmediately(cursor.consumeAsync()));
return relationship;
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw AsyncSessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw AsyncSessionTransaction.translateClientException(cex);
}
}
use of org.neo4j.driver.exceptions.DatabaseException in project structr by structr.
the class AsyncSessionTransaction method getStrings.
@Override
public Iterable<String> getStrings(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final ResultCursor cursor = resolveImmediately(tx.runAsync(statement, map));
final List<String> immutable = resolveImmediately(cursor.peekAsync()).get(0).asList(Values.ofString());
logSummary(resolveImmediately(cursor.consumeAsync()));
return new LinkedList<>(immutable);
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw AsyncSessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw AsyncSessionTransaction.translateClientException(cex);
}
}
use of org.neo4j.driver.exceptions.DatabaseException in project structr by structr.
the class AsyncSessionTransaction method getNode.
@Override
public Node getNode(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final ResultCursor cursor = resolveImmediately(tx.runAsync(statement, map));
final CompletionStage<Record> peek = cursor.peekAsync();
final Record record = resolveImmediately(peek);
Node node = null;
if (record != null) {
node = record.get(0).asNode();
}
logSummary(resolveImmediately(cursor.consumeAsync()));
return node;
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw AsyncSessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw AsyncSessionTransaction.translateClientException(cex);
}
}
use of org.neo4j.driver.exceptions.DatabaseException in project structr by structr.
the class ReactiveSessionTransaction method getBoolean.
@Override
public boolean getBoolean(final String statement, final Map<String, Object> map) {
try {
logQuery(statement, map);
final RxResult result = tx.run(statement, map);
final Publisher<Record> publisher = result.records();
final Record record = Mono.from(publisher).block();
final boolean value = record.get(0).asBoolean();
logSummary(Mono.from(result.consume()).block());
return value;
} catch (TransientException tex) {
closed = true;
throw new RetryException(tex);
} catch (NoSuchRecordException nex) {
throw new NotFoundException(nex);
} catch (ServiceUnavailableException ex) {
throw new NetworkException(ex.getMessage(), ex);
} catch (DatabaseException dex) {
throw ReactiveSessionTransaction.translateDatabaseException(dex);
} catch (ClientException cex) {
throw ReactiveSessionTransaction.translateClientException(cex);
}
}
Aggregations