use of org.jaffa.transaction.domain.TransactionDependency in project jaffa-framework by jaffa-projects.
the class TransactionEngine method createTransactionDependency.
public void createTransactionDependency(UOW uow, Transaction transaction, String dependsOnId) throws ApplicationException, ApplicationExceptions, FrameworkException {
TransactionDependency transactionDependency = null;
if (transaction != null && dependsOnId != null) {
transactionDependency = new TransactionDependency();
transactionDependency.setTransactionId(transaction.getId());
transactionDependency.setDependsOnId(dependsOnId);
transactionDependency.setStatus(Transaction.Status.O.toString());
TransactionMessageDAO transactionDAO = getTransactionDAO();
transactionDAO.save(uow, transactionDependency);
// Set the transaction to hold status. This will get fulfilled once the transaction dependency is satisfied
transaction.setStatus(Transaction.Status.H.toString());
transactionDAO.save(uow, transaction);
}
if (log.isDebugEnabled()) {
log.debug("Created TransactionDependency " + transactionDependency);
}
}
use of org.jaffa.transaction.domain.TransactionDependency in project jaffa-framework by jaffa-projects.
the class JaffaTransactionMessageService method getTransactionDependencies.
/**
* Gets the TransactionDependency collection of the Transaction with the input ID.
*
* @param transactionId the ID of the Transaction to return the TransactionDependencies of
* @return the TransactionDependencies of the Transaction with the input ID
* @throws FrameworkException
*/
@Override
public Collection<TransactionDependency> getTransactionDependencies(String transactionId) throws FrameworkException {
UOW uow = null;
List<TransactionDependency> results = new ArrayList<TransactionDependency>();
try {
uow = new UOW();
Criteria criteria = new Criteria();
criteria.setTable(TransactionDependencyMeta.getName());
criteria.addCriteria(TransactionDependencyMeta.TRANSACTION_ID, transactionId);
for (Object result : uow.query(criteria)) {
results.add((TransactionDependency) result);
}
} finally {
if (uow != null) {
uow.close();
}
}
return results;
}
Aggregations