use of org.structr.common.error.DatabaseServiceNetworkException in project structr by structr.
the class TransactionCommand method beginTx.
public TransactionCommand beginTx() throws FrameworkException {
final DatabaseService graphDb = (DatabaseService) arguments.get("graphDb");
TransactionReference tx = transactions.get();
if (graphDb != null) {
if (tx == null) {
try {
// start new transaction
tx = new TransactionReference(graphDb.beginTx());
} catch (NetworkException nex) {
throw new DatabaseServiceNetworkException(503, nex.getMessage());
}
queues.set(new ModificationQueue());
buffers.set(new ErrorBuffer());
transactions.set(tx);
currentCommand.set(this);
}
// increase depth
tx.begin();
} else {
throw new DatabaseServiceNotAvailableException(503, "Database service is not available, ensure the database is running and that there is a working network connection to it");
}
return this;
}
Aggregations