Search in sources :

Example 1 with AccountTrxDto

use of org.mifos.dto.domain.AccountTrxDto in project head by mifos.

the class StandardAccountService method makePaymentsForImport.

/**
     * method created for undo transaction import ability MIFOS-5702
     * changed return type 
     * */
@Override
public List<AccountTrxDto> makePaymentsForImport(List<AccountPaymentParametersDto> accountPaymentParametersDtoList) throws PersistenceException, AccountException {
    /*
         * We're counting on rollback on exception behavior in BaseAction. If we want to expose makePayments via a
         * non-Mifos-Web-UI service, we'll need to handle the rollback here.
         */
    List<AccountTrxDto> trxIds = new ArrayList<AccountTrxDto>();
    List<AccountBO> accounts = new ArrayList<AccountBO>();
    StaticHibernateUtil.startTransaction();
    int i = 0;
    for (AccountPaymentParametersDto accountPaymentParametersDTO : accountPaymentParametersDtoList) {
        CollectionUtils.addIgnoreNull(accounts, makeImportedPayments(accountPaymentParametersDTO));
        if (i % 30 == 0) {
            StaticHibernateUtil.getSessionTL().flush();
            StaticHibernateUtil.getSessionTL().clear();
        }
        i++;
    }
    StaticHibernateUtil.getSessionTL().flush();
    StaticHibernateUtil.getSessionTL().clear();
    StaticHibernateUtil.commitTransaction();
    for (AccountBO account : accounts) {
        trxIds.add(new AccountTrxDto(getAccTrxId(account)));
    }
    return trxIds;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) AccountTrxDto(org.mifos.dto.domain.AccountTrxDto) ArrayList(java.util.ArrayList) AccountPaymentParametersDto(org.mifos.dto.domain.AccountPaymentParametersDto)

Example 2 with AccountTrxDto

use of org.mifos.dto.domain.AccountTrxDto in project head by mifos.

the class ImportedFilesServiceImpl method saveImportedFileName.

@Override
public void saveImportedFileName(String fileName, PersonnelBO submittedBy, List<AccountTrxDto> idsToUndoImport, Boolean phaseOut, Boolean undoable) {
    Timestamp submittedOn = new Timestamp(new DateTimeService().getCurrentDateTime().getMillis());
    Set<AccountTrxnEntity> accTrxEnt = new HashSet<AccountTrxnEntity>();
    ImportedFilesEntity importedFile = new ImportedFilesEntity(fileName, submittedOn, submittedBy, accTrxEnt, phaseOut, undoable);
    if (null != idsToUndoImport) {
        for (AccountTrxDto trx : idsToUndoImport) {
            accTrxEnt.add(importedFileDao.getAccTrxById(trx.getId()));
        }
        importedFile.setImportedTrxn(accTrxEnt);
    }
    try {
        hibernateTransactionHelper.startTransaction();
        importedFileDao.saveImportedFile(importedFile);
        hibernateTransactionHelper.commitTransaction();
    } catch (Exception e) {
        hibernateTransactionHelper.rollbackTransaction();
        throw new MifosRuntimeException(e);
    } finally {
        hibernateTransactionHelper.closeSession();
    }
}
Also used : AccountTrxnEntity(org.mifos.accounts.business.AccountTrxnEntity) AccountTrxDto(org.mifos.dto.domain.AccountTrxDto) Timestamp(java.sql.Timestamp) DateTimeService(org.mifos.framework.util.DateTimeService) ImportedFilesEntity(org.mifos.application.importexport.business.ImportedFilesEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException) HashSet(java.util.HashSet) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

AccountTrxDto (org.mifos.dto.domain.AccountTrxDto)2 Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 AccountBO (org.mifos.accounts.business.AccountBO)1 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)1 ImportedFilesEntity (org.mifos.application.importexport.business.ImportedFilesEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)1 AccountPaymentParametersDto (org.mifos.dto.domain.AccountPaymentParametersDto)1 DateTimeService (org.mifos.framework.util.DateTimeService)1