Search in sources :

Example 1 with TransactionSweeperView

use of org.jaffa.transaction.domain.TransactionSweeperView in project jaffa-framework by jaffa-projects.

the class JaffaTransactionMessageService method getSweeperViewIfOnHoldNoOpenDependency.

/**
 * Takes a Transaction ID and returns the TransactionSweeperView if the Transaction is in the Hold state but has no
 * TransactionDependency in the Open state.  The TransactionSweeperView is a subset of the Transaction model.
 *
 * @param transactionId the ID of the Transaction in question
 * @return a TransactionSweeperView created from the Transaction with the input ID if that Transaction is in
 *         the Hold state but has no TransactionDependency in the Open state.
 * @throws FrameworkException
 */
@Override
public TransactionSweeperView getSweeperViewIfOnHoldNoOpenDependency(String transactionId) throws FrameworkException {
    UOW uow = null;
    TransactionSweeperView transactionSweeperView = null;
    try {
        uow = new UOW();
        Criteria criteria = new Criteria();
        criteria.setTable(TransactionSweeperViewMeta.getName());
        criteria.addCriteria(TransactionSweeperViewMeta.ID, transactionId);
        for (Object result : uow.query(criteria)) {
            if (result instanceof TransactionSweeperView) {
                transactionSweeperView = (TransactionSweeperView) result;
                break;
            }
        }
    } finally {
        if (uow != null) {
            uow.close();
        }
    }
    return transactionSweeperView;
}
Also used : TransactionSweeperView(org.jaffa.transaction.domain.TransactionSweeperView) Criteria(org.jaffa.persistence.Criteria) TransactionFieldCriteria(org.jaffa.transaction.apis.data.TransactionFieldCriteria) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) TransactionCriteria(org.jaffa.transaction.apis.data.TransactionCriteria) UOW(org.jaffa.persistence.UOW)

Example 2 with TransactionSweeperView

use of org.jaffa.transaction.domain.TransactionSweeperView in project jaffa-framework by jaffa-projects.

the class JaffaTransactionMessageService method getSweeperViewsIfOnHoldNoOpenDependency.

/**
 * Returns all of the TransactionSweeperViews of the Transactions in the Hold state that have no
 * TransactionDependency in the Open state.  The TransactionSweeperView is a subset of the Transaction model.
 *
 * @return all TransactionSweeperViews created from the Transactions in the Hold state that have
 *         no TransactionDependency in the Open state.
 * @throws FrameworkException
 */
@Override
public Collection<TransactionSweeperView> getSweeperViewsIfOnHoldNoOpenDependency() throws FrameworkException {
    UOW uow = null;
    Collection<TransactionSweeperView> results = new ArrayList<TransactionSweeperView>();
    try {
        uow = new UOW();
        Criteria criteria = new Criteria();
        criteria.setTable(TransactionSweeperViewMeta.getName());
        // create a list of transactionSweeperViews from the results
        for (Object result : uow.query(criteria)) {
            if (!(result instanceof TransactionSweeperView)) {
                continue;
            }
            results.add((TransactionSweeperView) result);
        }
    } finally {
        if (uow != null) {
            uow.close();
        }
    }
    return results;
}
Also used : TransactionSweeperView(org.jaffa.transaction.domain.TransactionSweeperView) ArrayList(java.util.ArrayList) Criteria(org.jaffa.persistence.Criteria) TransactionFieldCriteria(org.jaffa.transaction.apis.data.TransactionFieldCriteria) AtomicCriteria(org.jaffa.persistence.AtomicCriteria) TransactionCriteria(org.jaffa.transaction.apis.data.TransactionCriteria) UOW(org.jaffa.persistence.UOW)

Aggregations

AtomicCriteria (org.jaffa.persistence.AtomicCriteria)2 Criteria (org.jaffa.persistence.Criteria)2 UOW (org.jaffa.persistence.UOW)2 TransactionCriteria (org.jaffa.transaction.apis.data.TransactionCriteria)2 TransactionFieldCriteria (org.jaffa.transaction.apis.data.TransactionFieldCriteria)2 TransactionSweeperView (org.jaffa.transaction.domain.TransactionSweeperView)2 ArrayList (java.util.ArrayList)1