use of org.mifos.dto.domain.LoanActivityDto in project head by mifos.
the class LoanAccountActionStrutsTest method testGetAllActivity.
@Test
public void testGetAllActivity() throws Exception {
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
Date startDate = new Date(System.currentTimeMillis());
accountBO = getLoanAccount(AccountState.LOAN_APPROVED, startDate, 1);
LoanBO loan = (LoanBO) accountBO;
setRequestPathInfo("/loanAccountAction.do");
addRequestParameter("method", "getAllActivity");
addRequestParameter("globalAccountNum", loan.getGlobalAccountNum());
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyForward("getAllActivity_success");
Assert.assertEquals(1, ((List<LoanActivityDto>) SessionUtils.getAttribute(LoanConstants.LOAN_ALL_ACTIVITY_VIEW, request)).size());
}
use of org.mifos.dto.domain.LoanActivityDto in project head by mifos.
the class GroupLoanAccountServiceFacadeWebTier method getLoanActivityView.
private LoanActivityDto getLoanActivityView(final LoanActivityEntity loanActivity) {
LoanActivityDto loanActivityDto = new LoanActivityDto();
loanActivityDto.setId(loanActivity.getAccount().getAccountId());
loanActivityDto.setActionDate(loanActivity.getTrxnCreatedDate());
loanActivityDto.setActivity(loanActivity.getComments());
loanActivityDto.setPrincipal(removeSign(loanActivity.getPrincipal()).toString());
loanActivityDto.setInterest(removeSign(loanActivity.getInterest()).toString());
loanActivityDto.setPenalty(removeSign(loanActivity.getPenalty()).toString());
loanActivityDto.setFees(removeSign(loanActivity.getFee()).toString());
Money total = removeSign(loanActivity.getFee()).add(removeSign(loanActivity.getPenalty())).add(removeSign(loanActivity.getPrincipal())).add(removeSign(loanActivity.getInterest()));
loanActivityDto.setTotal(total.toString());
loanActivityDto.setTotalValue(total.getAmount().doubleValue());
loanActivityDto.setTimeStamp(loanActivity.getTrxnCreatedDate());
loanActivityDto.setRunningBalanceInterest(loanActivity.getInterestOutstanding().toString());
loanActivityDto.setRunningBalancePrinciple(loanActivity.getPrincipalOutstanding().toString());
loanActivityDto.setRunningBalanceFees(loanActivity.getFeeOutstanding().toString());
loanActivityDto.setRunningBalancePenalty(loanActivity.getPenaltyOutstanding().toString());
loanActivityDto.setRunningBalancePrincipleWithInterestAndFees(loanActivity.getPrincipalOutstanding().add(loanActivity.getInterestOutstanding()).add(loanActivity.getFeeOutstanding()).toString());
return loanActivityDto;
}
use of org.mifos.dto.domain.LoanActivityDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method getLoanActivityView.
private LoanActivityDto getLoanActivityView(final LoanActivityEntity loanActivity) {
LoanActivityDto loanActivityDto = new LoanActivityDto();
loanActivityDto.setId(loanActivity.getAccount().getAccountId());
loanActivityDto.setActionDate(loanActivity.getTrxnCreatedDate());
loanActivityDto.setActivity(loanActivity.getComments());
loanActivityDto.setPrincipal(removeSign(loanActivity.getPrincipal()).toString());
loanActivityDto.setInterest(removeSign(loanActivity.getInterest()).toString());
loanActivityDto.setPenalty(removeSign(loanActivity.getPenalty()).toString());
loanActivityDto.setFees(removeSign(loanActivity.getFee()).toString());
Money total = removeSign(loanActivity.getFee()).add(removeSign(loanActivity.getPenalty())).add(removeSign(loanActivity.getPrincipal())).add(removeSign(loanActivity.getInterest()));
loanActivityDto.setTotal(total.toString());
loanActivityDto.setTotalValue(total.getAmount().doubleValue());
loanActivityDto.setTimeStamp(loanActivity.getTrxnCreatedDate());
loanActivityDto.setRunningBalanceInterest(loanActivity.getInterestOutstanding().toString());
loanActivityDto.setRunningBalancePrinciple(loanActivity.getPrincipalOutstanding().toString());
loanActivityDto.setRunningBalanceFees(loanActivity.getFeeOutstanding().toString());
loanActivityDto.setRunningBalancePenalty(loanActivity.getPenaltyOutstanding().toString());
loanActivityDto.setRunningBalancePrincipleWithInterestAndFees(loanActivity.getPrincipalOutstanding().add(loanActivity.getInterestOutstanding()).add(loanActivity.getFeeOutstanding()).toString());
return loanActivityDto;
}
use of org.mifos.dto.domain.LoanActivityDto in project head by mifos.
the class LoanActivityTag method doStartTag.
@Override
public int doStartTag() throws JspException {
XmlBuilder xmlBuilder = new XmlBuilder();
try {
String currentFlowKey = (String) pageContext.getRequest().getAttribute(Constants.CURRENTFLOWKEY);
HttpSession session = pageContext.getSession();
FlowManager flowManager = (FlowManager) session.getAttribute(Constants.FLOWMANAGER);
Object object = flowManager.getFromFlow(currentFlowKey, LoanConstants.LOAN_ALL_ACTIVITY_VIEW);
if (object == null) {
// for spring/ftl
object = pageContext.getRequest().getAttribute(LoanConstants.LOAN_ALL_ACTIVITY_VIEW);
}
if (null != object) {
UserContext userContext = (UserContext) pageContext.getSession().getAttribute(Constants.USER_CONTEXT_KEY);
locale = userContext.getPreferredLocale();
xmlBuilder.startTag("table", "width", "100%", "border", "0", "cellspacing", "0", "cellpadding", "0", "id", "accountActivityTable");
xmlBuilder.startTag("tr");
xmlBuilder.startTag("td", "colspan", "8");
//xmlBuilder.nonBreakingSpace();
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "colspan", "4", "class", "drawtablerowboldnoline");
xmlBuilder.text(getLabel("loan.running_bal", locale));
xmlBuilder.endTag("td");
xmlBuilder.endTag("tr");
xmlBuilder.startTag("tr", "class", "drawtablerowbold");
xmlBuilder.startTag("td", "width", "9%", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.date", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "19%", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.activity", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.principal", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(ApplicationContextProvider.getBean(MessageLookup.class).lookupLabel(ConfigurationConstants.INTEREST));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.fees", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.penalty", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "6%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.total", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "4", "align", "right", "class", "fontnormalbold");
//xmlBuilder.nonBreakingSpace();
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.principal", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(ApplicationContextProvider.getBean(MessageLookup.class).lookupLabel(ConfigurationConstants.INTEREST));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "8%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.fees", locale));
xmlBuilder.endTag("td");
xmlBuilder.startTag("td", "width", "6%", "align", "right", "class", "drawtablerowbold");
xmlBuilder.text(getLabel("loan.total", locale));
xmlBuilder.endTag("td");
xmlBuilder.endTag("tr");
List<LoanActivityDto> loanRecentActivityViewSet = (List<LoanActivityDto>) object;
Iterator<LoanActivityDto> it = loanRecentActivityViewSet.iterator();
while (it.hasNext()) {
LoanActivityDto loanActivityDto = it.next();
xmlBuilder.startTag("tr", "valign", "top");
xmlBuilder.append(buildLeftHeaderRows(loanActivityDto));
xmlBuilder.append(buildRightHeaderRows(loanActivityDto));
xmlBuilder.endTag("tr");
}
xmlBuilder.endTag("table");
}
pageContext.getOut().write(xmlBuilder.toString());
} catch (Exception e) {
throw new JspException(e);
}
return SKIP_BODY;
}
use of org.mifos.dto.domain.LoanActivityDto in project head by mifos.
the class LoanAccountAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
LoanAccountActionForm loanAccountActionForm = (LoanAccountActionForm) form;
loanAccountActionForm.clearDetailsForLoan();
String globalAccountNum = request.getParameter(GLOBAL_ACCOUNT_NUM);
UserContext userContext = getUserContext(request);
LoanInformationDto loanInformationDto;
try {
loanInformationDto = this.loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
request.getSession().setAttribute("guarantyInformation", loanAccountServiceFacade.handleGuaranties(loanInformationDto));
final String accountStateNameLocalised = ApplicationContextProvider.getBean(MessageLookup.class).lookup(loanInformationDto.getAccountStateName());
SessionUtils.removeThenSetAttribute("accountStateNameLocalised", accountStateNameLocalised, request);
final String gracePeriodTypeNameLocalised = ApplicationContextProvider.getBean(MessageLookup.class).lookup(loanInformationDto.getGracePeriodTypeName());
SessionUtils.removeThenSetAttribute("gracePeriodTypeNameLocalised", gracePeriodTypeNameLocalised, request);
final String interestTypeNameLocalised = ApplicationContextProvider.getBean(MessageLookup.class).lookup(loanInformationDto.getInterestTypeName());
SessionUtils.removeThenSetAttribute("interestTypeNameLocalised", interestTypeNameLocalised, request);
final Set<String> accountFlagStateEntityNamesLocalised = new HashSet<String>();
for (String name : loanInformationDto.getAccountFlagNames()) {
accountFlagStateEntityNamesLocalised.add(ApplicationContextProvider.getBean(MessageLookup.class).lookup(name));
}
SessionUtils.setCollectionAttribute("accountFlagNamesLocalised", accountFlagStateEntityNamesLocalised, request);
SessionUtils.removeAttribute(BUSINESS_KEY, request);
Integer loanIndividualMonitoringIsEnabled = configurationPersistence.getConfigurationValueInteger(LOAN_INDIVIDUAL_MONITORING_IS_ENABLED);
if (null != loanIndividualMonitoringIsEnabled && loanIndividualMonitoringIsEnabled.intValue() != 0) {
SessionUtils.setAttribute(LOAN_INDIVIDUAL_MONITORING_IS_ENABLED, loanIndividualMonitoringIsEnabled.intValue(), request);
}
Boolean GroupLoanWithMembers = AccountingRules.isGroupLoanWithMembers();
if (null != GroupLoanWithMembers && GroupLoanWithMembers != false) {
SessionUtils.setAttribute("GroupLoanWithMembers", GroupLoanWithMembers.booleanValue(), request);
}
List<ValueListElement> allLoanPurposes = this.loanProductDao.findAllLoanPurposes();
// List<BusinessActivityEntity> loanPurposes = (List<BusinessActivityEntity>)masterDataService.retrieveMasterEntities(MasterConstants.LOAN_PURPOSES, getUserContext(request).getLocaleId());
SessionUtils.setCollectionAttribute(MasterConstants.BUSINESS_ACTIVITIES, allLoanPurposes, request);
if ((null != loanIndividualMonitoringIsEnabled && 0 != loanIndividualMonitoringIsEnabled.intValue() || (null != GroupLoanWithMembers && GroupLoanWithMembers != false)) && loanInformationDto.isGroup()) {
List<LoanAccountDetailsDto> loanAccountDetails = this.loanAccountServiceFacade.retrieveLoanAccountDetails(loanInformationDto);
addEmptyBuisnessActivities(loanAccountDetails);
SessionUtils.setCollectionAttribute("loanAccountDetailsView", loanAccountDetails, request);
}
SessionUtils.setCollectionAttribute(CUSTOM_FIELDS, new ArrayList<CustomFieldDefinitionEntity>(), request);
// Retrieve and set into the session all collateral types from the
// lookup_value_locale table associated with the current user context
// locale
SessionUtils.setCollectionAttribute(MasterConstants.COLLATERAL_TYPES, legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES).getCustomValueListElements(), request);
SessionUtils.setAttribute(AccountConstants.LAST_PAYMENT_ACTION, loanBusinessService.getLastPaymentAction(loanInformationDto.getAccountId()), request);
SessionUtils.removeThenSetAttribute("loanInformationDto", loanInformationDto, request);
// inject preferred date
List<LoanActivityDto> activities = loanInformationDto.getRecentAccountActivity();
for (LoanActivityDto activity : activities) {
activity.setUserPrefferedDate(DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), activity.getActionDate().toString()));
}
SessionUtils.setCollectionAttribute(RECENTACCOUNTACTIVITIES, activities, request);
request.setAttribute(CustomerConstants.SURVEY_KEY, loanInformationDto.getAccountSurveys());
request.setAttribute(CustomerConstants.SURVEY_COUNT, loanInformationDto.getActiveSurveys());
request.setAttribute(AccountConstants.SURVEY_KEY, loanInformationDto.getAccountSurveys());
Integer administrativeDocumentsIsEnabled = configurationPersistence.getConfigurationValueInteger(ADMINISTRATIVE_DOCUMENT_IS_ENABLED);
if (null != administrativeDocumentsIsEnabled && administrativeDocumentsIsEnabled.intValue() == 1) {
SessionUtils.setCollectionAttribute(AdminDocumentsContants.ADMINISTRATIVEDOCUMENTSLIST, legacyAdminDocumentDao.getAllActiveAdminDocuments(), request);
SessionUtils.setCollectionAttribute(AdminDocumentsContants.ADMINISTRATIVEDOCUMENTSACCSTATEMIXLIST, legacyAdminDocAccStateMixDao.getAllMixedAdminDocuments(), request);
}
List<QuestionGroupInstanceDetail> questions = new ArrayList<QuestionGroupInstanceDetail>();
QuestionnaireServiceFacade questionnaireServiceFacade = ApplicationContextProvider.getBean(QuestionnaireServiceFacade.class);
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(loanInformationDto.getAccountId(), "Create", "Loan"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(loanInformationDto.getAccountId(), "Approve", "Loan"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(loanInformationDto.getAccountId(), "View", "Loan"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(loanInformationDto.getAccountId(), "Disburse", "Loan"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(loanInformationDto.getAccountId(), "Close", "Loan"));
SessionUtils.setCollectionAttribute("questionGroups", questions, request);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("Loan"), request);
// John W - temporarily put back because needed in applychargeaction - update
// keithW - and for recentAccountNotes
LoanBO loan = getLoan(loanInformationDto.getAccountId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, loan, request);
LoanAccountAction.setSessionAtributeForGLIM(request, loan);
setCurrentPageUrl(request, loan);
setQuestionGroupInstances(request, loan);
setOverpayments(request, loan);
List<RepaymentScheduleInstallment> installments = loan.toRepaymentScheduleDto(userContext.getPreferredLocale());
loanAccountActionForm.initializeInstallments(installments);
return mapping.findForward(ActionForwards.get_success.toString());
}
Aggregations