use of org.mifos.accounts.servicefacade.UserContextFactory in project head by mifos.
the class CollectionSheetServiceFacadeWebTier method saveCollectionSheet.
@Override
public CollectionSheetErrorsDto saveCollectionSheet(final CollectionSheetEntryGridDto previousCollectionSheetEntryDto, final Short userId) {
final SaveCollectionSheetDto saveCollectionSheetDto = new SaveCollectionSheetFromLegacyAssembler().fromWebTierLegacyStructuretoSaveCollectionSheetDto(previousCollectionSheetEntryDto, userId);
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
int customerId = saveCollectionSheetDto.getSaveCollectionSheetCustomers().get(0).getCustomerId();
CustomerBO customerBO = this.customerDao.findCustomerById(customerId);
try {
personnelDao.checkAccessPermission(userContext, customerBO.getOfficeId(), customerBO.getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
monthClosingServiceFacade.validateTransactionDate(saveCollectionSheetDto.getTransactionDate().toDateMidnight().toDate());
return saveCollectionSheet(saveCollectionSheetDto);
}
use of org.mifos.accounts.servicefacade.UserContextFactory in project head by mifos.
the class CustomerSearchServiceFacadeWebTier method search.
@Override
public CustomerHierarchyDto search(String searchString, Short officeId, int pageNumber, int pageSize, SearchFiltersDto filters) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
if (searchString == null) {
throw new MifosRuntimeException(CenterConstants.NO_SEARCH_STRING);
}
String normalisedSearchString = org.mifos.framework.util.helpers.SearchUtils.normalizeSearchString(searchString);
if (normalisedSearchString.equals("")) {
throw new MifosRuntimeException(CenterConstants.NO_SEARCH_STRING);
}
CustomerHierarchyDto customerHierarchyDto = new CustomerHierarchyDto();
QueryResult searchResult = null;
List<CustomerSearchDto> resultList = null;
try {
searchResult = new CustomerPersistence().search(normalisedSearchString, officeId, userContext.getId(), userContext.getBranchId(), filters);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
try {
resultList = searchResult.get(pageNumber, pageSize);
customerHierarchyDto.setSize(searchResult.getSize());
customerHierarchyDto.setSearchResultSize(resultList.size());
} catch (HibernateSearchException e) {
throw new MifosRuntimeException(e);
}
/* FIXME: QueryResult.get returns CustomerSearchDto with messed up customers and accounts data.
*/
for (CustomerSearchDto customerSearchDto : resultList) {
if (customerSearchDto.getCustomerType() == 1) {
ClientSearchResultDto clientSearchResultDto = new ClientSearchResultDto();
clientSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
clientSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
/* QueryResult.get returns CustomerSearchDto (as Client) with clientName as centerName,
* clientGobalCustNum as centerGobalCustNum and vice versa
*/
clientSearchResultDto.setClientName(customerSearchDto.getCenterName());
clientSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
clientSearchResultDto.setGroupName(customerSearchDto.getGroupName());
clientSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
clientSearchResultDto.setCenterName(customerSearchDto.getClientName());
clientSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
clientSearchResultDto.setBranchName(customerSearchDto.getBranchName());
clientSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
clientSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
clientSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
clientSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object loanGlobalAccount : customerSearchDto.getLoanGlobalAccountNum()) {
String accountStr = (String) loanGlobalAccount;
clientSearchResultDto.getLoanGlobalAccountNum().add(accountStr);
clientSearchResultDto.getLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
clientSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
clientSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
for (Object groupLoanAccount : customerSearchDto.getGroupLoanGlobalAccountNum()) {
String accountStr = (String) groupLoanAccount;
clientSearchResultDto.getGroupLoanGlobalAccountNum().add(accountStr);
clientSearchResultDto.getGroupLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
clientSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getClients().add(clientSearchResultDto);
} else if (customerSearchDto.getCustomerType() == 2) {
GroupSearchResultDto groupSearchResultDto = new GroupSearchResultDto();
groupSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
groupSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
/* QueryResult.get returns CustomerSearchDto (as Group) with groupName as centerName,
* groupGobalCustNum as centerGobalCustNum and vice versa
*/
groupSearchResultDto.setGroupName(customerSearchDto.getCenterName());
groupSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
groupSearchResultDto.setCenterName(customerSearchDto.getGroupName());
groupSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
groupSearchResultDto.setBranchName(customerSearchDto.getBranchName());
groupSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
groupSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
groupSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
groupSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object loanGlobalAccount : customerSearchDto.getLoanGlobalAccountNum()) {
String accountStr = (String) loanGlobalAccount;
groupSearchResultDto.getLoanGlobalAccountNum().add(accountStr);
groupSearchResultDto.getLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
groupSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
groupSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
for (Object groupLoanAccount : customerSearchDto.getGroupLoanGlobalAccountNum()) {
String accountStr = (String) groupLoanAccount;
groupSearchResultDto.getGroupLoanGlobalAccountNum().add(accountStr);
groupSearchResultDto.getGroupLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
groupSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getGroups().add(groupSearchResultDto);
} else if (customerSearchDto.getCustomerType() == 3) {
CenterSearchResultDto centerSearchResultDto = new CenterSearchResultDto();
centerSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
centerSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
centerSearchResultDto.setCenterName(customerSearchDto.getCenterName());
centerSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
centerSearchResultDto.setBranchName(customerSearchDto.getBranchName());
centerSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
centerSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
centerSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
centerSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
centerSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
centerSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
centerSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getCenters().add(centerSearchResultDto);
} else if (customerSearchDto.getLoanGlobalAccountNumber() != null && (customerSearchDto.getCustomerType() == 5 || customerSearchDto.getCustomerType() == 4 || customerSearchDto.getCustomerType() == 9) || customerSearchDto.getCustomerType() == 10) {
LoanAccountSearchResultDto loanAccountSearchResultDto = new LoanAccountSearchResultDto();
loanAccountSearchResultDto.setLoanGlobalAccountNum(customerSearchDto.getLoanGlobalAccountNumber());
loanAccountSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
loanAccountSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
loanAccountSearchResultDto.setBranchName(customerSearchDto.getBranchName());
loanAccountSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
loanAccountSearchResultDto.setAccountStatusId(customerSearchDto.getCustomerStatus());
loanAccountSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
loanAccountSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
//new group loan group or client account
if (customerSearchDto.getCustomerType() == 9 || customerSearchDto.getCustomerType() == 10) {
loanAccountSearchResultDto.setGroupLoan(Boolean.TRUE);
loanAccountSearchResultDto.setAccountStatusId(AccountTypes.GROUP_LOAN_ACCOUNT.getValue());
}
if (customerSearchDto.getClientGlobalCustNum() != null) {
loanAccountSearchResultDto.setCenterName(customerSearchDto.getClientName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
loanAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setGroupName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else if (customerSearchDto.getCustomerType() == 5 || customerSearchDto.getCustomerType() == 9) {
loanAccountSearchResultDto.setGroupName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else {
loanAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setGroupName(customerSearchDto.getClientName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
loanAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
}
loanAccountSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.setLoan(loanAccountSearchResultDto);
} else if (customerSearchDto.getLoanGlobalAccountNumber() != null || customerSearchDto.getCustomerType() == 6) {
SavingsAccountSearchResultDto savingsAccountSearchResultDto = new SavingsAccountSearchResultDto();
savingsAccountSearchResultDto.setSavingsGlobalAccountNum(customerSearchDto.getLoanGlobalAccountNumber());
savingsAccountSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
savingsAccountSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
savingsAccountSearchResultDto.setBranchName(customerSearchDto.getBranchName());
savingsAccountSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
savingsAccountSearchResultDto.setAccountStatusId(customerSearchDto.getCustomerStatus());
savingsAccountSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
savingsAccountSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
if (customerSearchDto.getClientGlobalCustNum() != null) {
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getClientName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
savingsAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
savingsAccountSearchResultDto.setGroupName(customerSearchDto.getGroupName());
savingsAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else if (customerSearchDto.getGroupGlobalCustNum() != null) {
savingsAccountSearchResultDto.setClientName(customerSearchDto.getClientName());
savingsAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
savingsAccountSearchResultDto.setGroupName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else {
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
}
savingsAccountSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.setSavings(savingsAccountSearchResultDto);
}
}
return customerHierarchyDto;
}
use of org.mifos.accounts.servicefacade.UserContextFactory in project head by mifos.
the class CheckListServiceFacadeWebTier method updateAccountChecklist.
@Override
public void updateAccountChecklist(Short checklistId, Short productId, Short stateId, Short checklistStatus, String checklistName, List<String> checklistDetails) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
try {
ProductTypeEntity productTypeEntity = null;
for (ProductTypeEntity prdTypeEntity : new ProductCategoryBusinessService().getProductTypes()) {
if (productId.equals(prdTypeEntity.getProductTypeID())) {
productTypeEntity = prdTypeEntity;
break;
}
}
hibernateTransactionHelper.startTransaction();
AccountStateEntity accountStateEntity = new AccountStateEntity(AccountState.fromShort(stateId));
AccountCheckListBO accountCheckList = (AccountCheckListBO) new CheckListPersistence().getCheckList(checklistId);
accountCheckList.update(productTypeEntity, accountStateEntity, checklistName, checklistStatus, checklistDetails, userContext.getLocaleId(), userContext.getId());
customerDao.save(accountCheckList);
hibernateTransactionHelper.commitTransaction();
} catch (ServiceException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} catch (CheckListException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} catch (PersistenceException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
use of org.mifos.accounts.servicefacade.UserContextFactory in project head by mifos.
the class OfficeServiceFacadeWebTier method createOffice.
@Override
public ListElement createOffice(Short operationMode, OfficeDto officeDto) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
OfficeLevel level = OfficeLevel.getOfficeLevel(officeDto.getLevelId());
OfficeBO parentOffice = officeDao.findOfficeById(officeDto.getParentId());
AddressDto addressDto = officeDto.getAddress();
Address address = new Address(addressDto.getLine1(), addressDto.getLine2(), addressDto.getLine3(), addressDto.getCity(), addressDto.getState(), addressDto.getCountry(), addressDto.getZip(), addressDto.getPhoneNumber());
try {
OfficeBO officeBO = new OfficeBO(userContext, level, parentOffice, officeDto.getCustomFields(), officeDto.getName(), officeDto.getOfficeShortName(), address, OperationMode.fromInt(operationMode.intValue()));
OfficePersistence officePersistence = new OfficePersistence();
if (officePersistence.isOfficeNameExist(officeDto.getName())) {
throw new OfficeValidationException(OfficeConstants.OFFICENAMEEXIST);
}
if (officePersistence.isOfficeShortNameExist(officeDto.getOfficeShortName())) {
throw new OfficeValidationException(OfficeConstants.OFFICESHORTNAMEEXIST);
}
String searchId = generateSearchId(parentOffice);
officeBO.setSearchId(searchId);
String globalOfficeNum = generateOfficeGlobalNo();
officeBO.setGlobalOfficeNum(globalOfficeNum);
StaticHibernateUtil.startTransaction();
this.officeDao.save(officeBO);
StaticHibernateUtil.commitTransaction();
//Shahid - this is hackish solution to return officeId and globalOfficeNum via ListElement, it should be fixed, at least
//a proper data storage class can be created
ListElement element = new ListElement(new Integer(officeBO.getOfficeId()), officeBO.getGlobalOfficeNum());
// if we are here it means office created sucessfully
// we need to update hierarchy manager cache
OfficeSearch os = new OfficeSearch(officeBO.getOfficeId(), officeBO.getSearchId(), officeBO.getParentOffice().getOfficeId());
List<OfficeSearch> osList = new ArrayList<OfficeSearch>();
osList.add(os);
EventManger.postEvent(Constants.CREATE, osList, SecurityConstants.OFFICECHANGEEVENT);
return element;
} catch (OfficeValidationException e) {
StaticHibernateUtil.rollbackTransaction();
throw new BusinessRuleException(e.getMessage());
} catch (PersistenceException e) {
StaticHibernateUtil.rollbackTransaction();
throw new MifosRuntimeException(e);
} catch (OfficeException e) {
StaticHibernateUtil.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.accounts.servicefacade.UserContextFactory in project head by mifos.
the class AdminServiceFacadeWebTier method updateLoanProduct.
@Override
public PrdOfferingDto updateLoanProduct(LoanProductRequest loanProductRequest) {
LoanOfferingBO loanProductForUpdate = this.loanProductDao.findById(loanProductRequest.getProductDetails().getId());
// enforced by integrity constraints on table also.
if (loanProductForUpdate.isDifferentName(loanProductRequest.getProductDetails().getName())) {
this.savingsProductDao.validateProductWithSameNameDoesNotExist(loanProductRequest.getProductDetails().getName());
}
if (loanProductForUpdate.isDifferentShortName(loanProductRequest.getProductDetails().getShortName())) {
this.savingsProductDao.validateProductWithSameShortNameDoesNotExist(loanProductRequest.getProductDetails().getShortName());
}
// domain rule validation - put on domain entity
if (loanProductForUpdate.isDifferentStartDate(loanProductRequest.getProductDetails().getStartDate())) {
validateStartDateIsNotBeforeToday(loanProductRequest.getProductDetails().getStartDate());
validateStartDateIsNotOverOneYearFromToday(loanProductRequest.getProductDetails().getStartDate());
validateEndDateIsPastStartDate(loanProductRequest.getProductDetails().getStartDate(), loanProductRequest.getProductDetails().getEndDate());
}
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
LoanOfferingBO newLoanProductDetails = this.loanProductAssembler.fromDto(user, loanProductRequest);
loanProductForUpdate.updateDetails(userContext);
HibernateTransactionHelper transactionHelper = new HibernateTransactionHelperForStaticHibernateUtil();
try {
transactionHelper.startTransaction();
transactionHelper.beginAuditLoggingFor(loanProductForUpdate);
loanProductForUpdate.updateDetailsOfProductNotInUse(newLoanProductDetails.getPrdOfferingName(), newLoanProductDetails.getPrdOfferingShortName(), newLoanProductDetails.getDescription(), newLoanProductDetails.getPrdCategory(), newLoanProductDetails.getStartDate(), newLoanProductDetails.getEndDate(), newLoanProductDetails.getPrdApplicableMaster(), newLoanProductDetails.getPrdStatus());
loanProductForUpdate.update(newLoanProductDetails.isIncludeInLoanCounter(), newLoanProductDetails.isInterestWaived());
if (newLoanProductDetails.isLoanAmountTypeSameForAllLoan()) {
loanProductForUpdate.updateLoanAmountDetails(newLoanProductDetails.getEligibleLoanAmountSameForAllLoan());
} else if (newLoanProductDetails.isLoanAmountTypeAsOfLastLoanAmount()) {
loanProductForUpdate.updateLoanAmountByLastLoanDetails(newLoanProductDetails.getLoanAmountFromLastLoan());
} else if (newLoanProductDetails.isLoanAmountTypeFromLoanCycle()) {
loanProductForUpdate.updateLoanAmountLoanCycleDetails(newLoanProductDetails.getLoanAmountFromLoanCycle());
}
loanProductForUpdate.updateInterestRateDetails(newLoanProductDetails.getMinInterestRate(), newLoanProductDetails.getMaxInterestRate(), newLoanProductDetails.getDefInterestRate());
PrdOfferingMeetingEntity entity = newLoanProductDetails.getLoanOfferingMeeting();
MeetingBO meeting = new MeetingBO(entity.getMeeting().getRecurrenceType(), entity.getMeeting().getRecurAfter(), entity.getMeeting().getStartDate(), MeetingType.LOAN_INSTALLMENT);
loanProductForUpdate.updateRepaymentDetails(meeting, newLoanProductDetails.getGracePeriodType(), newLoanProductDetails.getGracePeriodDuration());
if (newLoanProductDetails.isNoOfInstallTypeSameForAllLoan()) {
loanProductForUpdate.updateInstallmentDetails(newLoanProductDetails.getNoOfInstallSameForAllLoan());
} else if (newLoanProductDetails.isNoOfInstallTypeFromLastLoan()) {
loanProductForUpdate.updateInstallmentByLastLoanDetails(newLoanProductDetails.getNoOfInstallFromLastLoan());
} else if (newLoanProductDetails.isNoOfInstallTypeFromLoanCycle()) {
loanProductForUpdate.updateInstallmentLoanCycleDetails(newLoanProductDetails.getNoOfInstallFromLoanCycle());
}
loanProductForUpdate.updateFees(newLoanProductDetails.getLoanOfferingFees());
loanProductForUpdate.updateFunds(newLoanProductDetails.getLoanOfferingFunds());
loanProductForUpdate.updatePenalties(newLoanProductDetails.getLoanOfferingPenalties());
this.loanProductDao.save(loanProductForUpdate);
transactionHelper.commitTransaction();
return loanProductForUpdate.toDto();
} catch (Exception e) {
transactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
transactionHelper.closeSession();
}
}
Aggregations