use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.
the class SavingsAction method getRecentActivity.
@TransactionDemarcate(joinToken = true)
public ActionForward getRecentActivity(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In SavingsAction::getRecentActivity()");
SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Long savingsId = savings.getAccountId().longValue();
List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsId);
SessionUtils.setCollectionAttribute(SavingsConstants.RECENTY_ACTIVITY_LIST, recentActivity, request);
return mapping.findForward("getRecentActivity_success");
}
use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.
the class SavingsActionStrutsTest method testSuccessfulGetRecentActivity.
@Test
public void testSuccessfulGetRecentActivity() throws Exception {
createInitialObjects();
Date currentDate = new Date(System.currentTimeMillis());
savingsOffering = TestObjectFactory.createSavingsProduct("sav prd1", "prd1", currentDate, RecommendedAmountUnit.COMPLETE_GROUP);
savings = createSavingsAccount("000X00000000018", savingsOffering, AccountState.SAVINGS_PARTIAL_APPLICATION);
savingsOffering = null;
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
SessionUtils.setAttribute(Constants.USER_CONTEXT_KEY, TestUtils.makeUser(), request.getSession());
setRequestPathInfo("/savingsAction.do");
addRequestParameter("method", "getRecentActivity");
addRequestParameter("globalAccountNum", savings.getGlobalAccountNum());
actionPerform();
verifyForward("getRecentActivity_success");
verifyNoActionErrors();
verifyNoActionMessages();
Assert.assertEquals(0, ((List<SavingsRecentActivityDto>) SessionUtils.getAttribute(SavingsConstants.RECENTY_ACTIVITY_LIST, request)).size());
}
use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.
the class SavingsAccountController method showSavingsAccountRecentActivity.
@RequestMapping(value = "/viewSavingsAccountRecentActivity", method = RequestMethod.GET)
public ModelAndView showSavingsAccountRecentActivity(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountRecentActivity", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
modelAndView.addObject("currentDate", new Date());
List<SavingsRecentActivityDto> recentActivity = this.savingsServiceFacade.retrieveRecentSavingsActivities(savingsAccountDetailDto.getAccountId().longValue());
request.setAttribute("recentActivityList", recentActivity);
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
return modelAndView;
}
use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.
the class SavingsBO method toDto.
public SavingsAccountDetailDto toDto() {
List<SavingsRecentActivityDto> recentActivity = this.getRecentAccountActivity(3);
List<CustomerNoteDto> recentNoteDtos = new ArrayList<CustomerNoteDto>();
List<AccountNotesEntity> recentNotes = this.getRecentAccountNotes();
for (AccountNotesEntity accountNotesEntity : recentNotes) {
recentNoteDtos.add(new CustomerNoteDto(accountNotesEntity.getCommentDate(), accountNotesEntity.getComment(), accountNotesEntity.getPersonnelName()));
}
SavingsPerformanceHistoryDto savingsPerformanceHistoryDto = new SavingsPerformanceHistoryDto(getActivationDate(), savingsPerformance.getTotalDeposits().toString(), savingsPerformance.getTotalWithdrawals().toString(), savingsPerformance.getTotalInterestEarned().toString(), savingsPerformance.getMissedDeposits() != null ? savingsPerformance.getMissedDeposits().toString() : "0");
AccountActionDateEntity nextInstallment = getDetailsOfNextInstallment();
return new SavingsAccountDetailDto(this.savingsOffering.toFullDto(), recentActivity, recentNoteDtos, this.recommendedAmount.toString(), this.globalAccountNum, getAccountId(), getState().getValue(), getState().name(), getSavingsBalance().toString(), nextInstallment != null ? nextInstallment.getActionDate() : null, getTotalAmountDue().toString(), getTotalAmountDueForNextInstallment().toString(), getTotalAmountInArrears().toString(), savingsPerformanceHistoryDto, this.savingsOffering.getSavingsTypeAsEnum().name(), this.customer.getCustomerId());
}
use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.
the class SavingsBO method createSavingsRecentActivityView.
private SavingsRecentActivityDto createSavingsRecentActivityView(final SavingsActivityEntity savingActivity) {
SavingsRecentActivityDto savingsRecentActivityDto = new SavingsRecentActivityDto();
savingsRecentActivityDto.setAccountTrxnId(savingActivity.getId());
savingsRecentActivityDto.setActionDate(savingActivity.getTrxnCreatedDate());
String preferredDate = DateUtils.getUserLocaleDate(this.userContext.getPreferredLocale(), savingActivity.getTrxnCreatedDate().toString());
savingsRecentActivityDto.setUserPrefferedDate(preferredDate);
savingsRecentActivityDto.setAmount(removeSign(savingActivity.getAmount()).toString());
savingsRecentActivityDto.setActivity(savingActivity.getActivity().getName());
savingsRecentActivityDto.setRunningBalance(savingActivity.getBalanceAmount().toString());
return savingsRecentActivityDto;
}
Aggregations