use of org.apache.nifi.admin.service.transaction.Transaction in project nifi by apache.
the class StandardAuditService method addActions.
@Override
public void addActions(Collection<Action> actions) {
Transaction transaction = null;
writeLock.lock();
try {
// start the transaction
transaction = transactionBuilder.start();
// seed the accounts
AddActionsAction addActions = new AddActionsAction(actions);
transaction.execute(addActions);
// commit the transaction
transaction.commit();
} catch (TransactionException | DataAccessException te) {
rollback(transaction);
throw new AdministrationException(te);
} catch (Throwable t) {
rollback(transaction);
throw t;
} finally {
closeQuietly(transaction);
writeLock.unlock();
}
}
use of org.apache.nifi.admin.service.transaction.Transaction in project nifi by apache.
the class StandardAuditService method getAction.
@Override
public Action getAction(Integer actionId) {
Transaction transaction = null;
Action action = null;
readLock.lock();
try {
// start the transaction
transaction = transactionBuilder.start();
// seed the accounts
GetActionAction getAction = new GetActionAction(actionId);
action = transaction.execute(getAction);
// commit the transaction
transaction.commit();
} catch (TransactionException | DataAccessException te) {
rollback(transaction);
throw new AdministrationException(te);
} catch (Throwable t) {
rollback(transaction);
throw t;
} finally {
closeQuietly(transaction);
readLock.unlock();
}
return action;
}
use of org.apache.nifi.admin.service.transaction.Transaction in project nifi by apache.
the class StandardAuditService method getPreviousValues.
@Override
public Map<String, List<PreviousValue>> getPreviousValues(String componentId) {
Transaction transaction = null;
Map<String, List<PreviousValue>> previousValues = null;
readLock.lock();
try {
// start the transaction
transaction = transactionBuilder.start();
// seed the accounts
GetPreviousValues getActions = new GetPreviousValues(componentId);
previousValues = transaction.execute(getActions);
// commit the transaction
transaction.commit();
} catch (TransactionException | DataAccessException te) {
rollback(transaction);
throw new AdministrationException(te);
} catch (Throwable t) {
rollback(transaction);
throw t;
} finally {
closeQuietly(transaction);
readLock.unlock();
}
return previousValues;
}
Aggregations