Search in sources :

Example 6 with TransactionDependency

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);
    }
}
Also used : TransactionMessageDAO(org.jaffa.transaction.daos.TransactionMessageDAO) TransactionDependency(org.jaffa.transaction.domain.TransactionDependency)

Example 7 with 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;
}
Also used : 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) TransactionDependency(org.jaffa.transaction.domain.TransactionDependency)

Aggregations

TransactionDependency (org.jaffa.transaction.domain.TransactionDependency)7 UOW (org.jaffa.persistence.UOW)5 AtomicCriteria (org.jaffa.persistence.AtomicCriteria)4 Criteria (org.jaffa.persistence.Criteria)4 TransactionCriteria (org.jaffa.transaction.apis.data.TransactionCriteria)4 TransactionFieldCriteria (org.jaffa.transaction.apis.data.TransactionFieldCriteria)4 ArrayList (java.util.ArrayList)3 LinkedHashMap (java.util.LinkedHashMap)1 ApplicationException (org.jaffa.exceptions.ApplicationException)1 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)1 FrameworkException (org.jaffa.exceptions.FrameworkException)1 MessageDependency (org.jaffa.qm.apis.data.MessageDependency)1 MessageField (org.jaffa.qm.apis.data.MessageField)1 MessageGraph (org.jaffa.qm.apis.data.MessageGraph)1 TransactionMessageDAO (org.jaffa.transaction.daos.TransactionMessageDAO)1 TransactionField (org.jaffa.transaction.domain.TransactionField)1 DisplayParam (org.jaffa.transaction.services.configdomain.DisplayParam)1 TypeInfo (org.jaffa.transaction.services.configdomain.TypeInfo)1