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;
}
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();
}
}
Aggregations