use of org.mifos.dto.domain.ValueListElement 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());
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class LoanAccountAction method populateClientDetailsFromLoan.
List<LoanAccountDetailsDto> populateClientDetailsFromLoan(final List<ClientBO> activeClientsUnderGroup, final List<LoanBO> individualLoans, final List<ValueListElement> businessActivities) {
List<LoanAccountDetailsDto> clientDetails = new ArrayList<LoanAccountDetailsDto>();
for (final ClientBO client : activeClientsUnderGroup) {
LoanAccountDetailsDto clientDetail = new LoanAccountDetailsDto();
clientDetail.setClientId(getStringValue(client.getCustomerId()));
clientDetail.setClientName(client.getDisplayName());
LoanBO loanAccount = (LoanBO) CollectionUtils.find(individualLoans, new Predicate() {
@Override
public boolean evaluate(final Object object) {
return client.getCustomerId().equals(((LoanBO) object).getCustomer().getCustomerId());
}
});
if (loanAccount != null) {
final Integer businessActivityId = loanAccount.getBusinessActivityId();
if (businessActivityId != null) {
clientDetail.setBusinessActivity(Integer.toString(businessActivityId));
ValueListElement businessActivityElement = (ValueListElement) CollectionUtils.find(businessActivities, new Predicate() {
@Override
public boolean evaluate(final Object object) {
return ((ValueListElement) object).getId().equals(businessActivityId);
}
});
if (businessActivityElement != null) {
clientDetail.setBusinessActivityName(businessActivityElement.getName());
}
}
clientDetail.setLoanAmount(loanAccount.getLoanAmount() != null ? loanAccount.getLoanAmount().toString() : "0.0");
}
clientDetails.add(clientDetail);
}
return clientDetails;
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class PersonnelServiceFacadeWebTier method retrieveInfoForNewUserDefinition.
@Override
public DefinePersonnelDto retrieveInfoForNewUserDefinition(Short officeId) {
String officeName = "";
if (officeId != null) {
OfficeBO office = officeDao.findOfficeById(officeId);
officeName = office.getOfficeName();
}
List<ValueListElement> titles = customerDao.retrieveTitles();
List<ListElement> titleList = new ArrayList<ListElement>();
for (ValueListElement element : titles) {
ListElement listElement = new ListElement(element.getId(), element.getName());
titleList.add(listElement);
}
List<PersonnelLevelEntity> personnelLevels = customerDao.retrievePersonnelLevels();
List<ListElement> personnelLevelList = new ArrayList<ListElement>();
for (PersonnelLevelEntity level : personnelLevels) {
String name = level.getLookUpValue().getLookUpName();
String localisedName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(name);
ListElement listElement = new ListElement(new Integer(level.getId()), localisedName);
personnelLevelList.add(listElement);
}
List<ValueListElement> genders = customerDao.retrieveGenders();
List<ListElement> genderList = new ArrayList<ListElement>();
for (ValueListElement element : genders) {
ListElement listElement = new ListElement(element.getId(), element.getName());
genderList.add(listElement);
}
List<ValueListElement> maritalStatuses = customerDao.retrieveMaritalStatuses();
List<ListElement> maritalStatusList = new ArrayList<ListElement>();
for (ValueListElement element : maritalStatuses) {
ListElement listElement = new ListElement(element.getId(), element.getName());
maritalStatusList.add(listElement);
}
List<RoleBO> roles = new ArrayList<RoleBO>();
try {
roles = rolesPermissionsPersistence.getRoles();
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
List<ListElement> roleList = new ArrayList<ListElement>();
for (RoleBO element : roles) {
ListElement listElement = new ListElement(new Integer(element.getId()), element.getName());
roleList.add(listElement);
}
List<ListElement> languageList = Localization.getInstance().getLocaleList();
DefinePersonnelDto defineUserDto = new DefinePersonnelDto(officeName, titleList, personnelLevelList, genderList, maritalStatusList, languageList, roleList);
return defineUserDto;
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class GroupIndividualLoanAccountAction 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;
}
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();
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.getSession().setAttribute("guarantyInformation", loanAccountServiceFacade.handleGuaranties(loanInformationDto));
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>();
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);
LoanBO loan = getLoan(loanInformationDto.getAccountId());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, loan, request);
setCurrentPageUrl(request, loan);
setOverpayments(request, loan);
List<RepaymentScheduleInstallment> installments = loan.toRepaymentScheduleDto(userContext.getPreferredLocale());
loanAccountActionForm.initializeInstallments(installments);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.dto.domain.ValueListElement in project head by mifos.
the class SearchResultController method getSearchResultAjaxData.
@RequestMapping(value = "/searchResultAjaxData", method = RequestMethod.GET)
public ModelAndView getSearchResultAjaxData(HttpServletResponse response, @ModelAttribute("customerSearch") CustomerSearchFormBean customerSearchFormBean, @RequestParam(required = false) String sEcho, @RequestParam Integer iDisplayStart, @RequestParam Integer iDisplayLength) throws PersistenceException {
ModelAndView modelAndView = new ModelAndView("searchResultAjaxData");
CustomerHierarchyDto customerHierarchyDto = new CustomerHierarchyDto();
boolean isCenterHierarchyExists = configurationServiceFacade.getBooleanConfig("ClientRules.CenterHierarchyExists");
modelAndView.addObject("isCenterHierarchyExists", isCenterHierarchyExists);
HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
customerStates.putAll(customerSearchServiceFacade.getAvailibleCustomerStates());
modelAndView.addObject("availibleCustomerStates", customerStates);
List<ValueListElement> availibleClientGenders = clientServiceFacade.getClientGenders();
modelAndView.addObject("availibleClientGenders", availibleClientGenders);
if (customerSearchFormBean.getSearchString() != null && !customerSearchFormBean.getSearchString().isEmpty()) {
customerHierarchyDto = customerSearchServiceFacade.search(customerSearchFormBean.getSearchString(), customerSearchFormBean.getOfficeId(), iDisplayStart, iDisplayLength, customerSearchFormBean.getFilters());
}
if (sEcho != null) {
modelAndView.addObject("sEcho", sEcho);
}
modelAndView.addObject("customerHierarchy", customerHierarchyDto);
modelAndView.addObject("iDisplayStart", iDisplayStart);
modelAndView.addObject("iDisplayLength", iDisplayLength);
return modelAndView;
}
Aggregations