use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class PictureFormFile method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String clientSystemId = ((ClientCustActionForm) form).getGlobalCustNum();
ClientInformationDto clientInformationDto;
try {
clientInformationDto = clientServiceFacade.getClientInformationDto(clientSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
// John W - for breadcrumb or another other action downstream that exists business_key set (until refactored)
ClientBO clientBO = (ClientBO) this.customerDao.findCustomerById(clientInformationDto.getClientDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, clientBO, request);
SessionUtils.setAttribute(ClientConstants.IS_PHOTO_FIELD_HIDDEN, FieldConfig.getInstance().isFieldHidden("Client.Photo"), request);
setCurrentPageUrl(request, clientBO);
setQuestionGroupInstances(request, clientBO);
InformationOrderServiceFacade informationOrderServiceFacade = ApplicationContextProvider.getBean(InformationOrderServiceFacade.class);
SessionUtils.removeThenSetAttribute("clientInformationDto", clientInformationDto, request);
request.getSession().setAttribute("guarantyClientInformation", loanAccountServiceFacade.retrieveGuarantyClientInformation(clientInformationDto));
QuestionnaireServiceFacade questionnaireServiceFacade = questionnaireServiceFacadeLocator.getService(request);
List<QuestionGroupInstanceDetail> questions = new ArrayList<QuestionGroupInstanceDetail>();
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Create", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "View", "Client"));
questions.addAll(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(clientInformationDto.getClientDisplay().getCustomerId(), "Close", "Client"));
SessionUtils.setCollectionAttribute("questionGroups", questions, request);
SessionUtils.setCollectionAttribute("personalInformationOrder", informationOrderServiceFacade.getInformationOrder("Client"), request);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class LoanAccountAction method getGroupLoanAccountDetails.
@TransactionDemarcate(saveToken = true)
public ActionForward getGroupLoanAccountDetails(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;
List<LoanInformationDto> memberloanInformationDtos = new ArrayList<LoanInformationDto>();
try {
loanInformationDto = this.loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
for (LoanBO member : loanDao.findByGlobalAccountNum(globalAccountNum).getMemberAccounts()) {
memberloanInformationDtos.add(this.loanAccountServiceFacade.retrieveLoanInformation(member.getGlobalAccountNum()));
request.getSession().setAttribute("guarantyInformation", loanAccountServiceFacade.handleGuaranties(this.loanAccountServiceFacade.retrieveLoanInformation(member.getGlobalAccountNum())));
}
} 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() && loanInformationDto.isGroup()) || loanInformationDto.isGroupLoanWithMembersEnabled() || (null != GroupLoanWithMembers && GroupLoanWithMembers != false)) {
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);
//loanAccountServiceFacade.putLoanBusinessKeyInSession(globalAccountNum, request);
List<LoanActivityDto> activities = loanInformationDto.getRecentAccountActivity();
for (LoanActivityDto activity : activities) {
activity.setUserPrefferedDate(DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), activity.getActionDate().toString()));
}
SessionUtils.removeAttribute(RECENTACCOUNTACTIVITIES, request.getSession());
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 = questionnaireServiceFacadeLocator.getService(request);
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);
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.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class ClientCustActionTest method getQuestionGroupInstanceDetail.
private QuestionGroupInstanceDetail getQuestionGroupInstanceDetail(String questionGroupTitle) {
QuestionGroupInstanceDetail detail = new QuestionGroupInstanceDetail();
detail.setDateCompleted(Calendar.getInstance().getTime());
detail.setQuestionGroupDetail(getQuestionGroupDetail(questionGroupTitle, asList("red", "green", "blue")));
return detail;
}
use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class CenterCustActionTest method shouldSetQuestionGroupInstanceDetailsInSession.
@Test
public void shouldSetQuestionGroupInstanceDetailsInSession() throws PageExpiredException {
List<QuestionGroupInstanceDetail> instanceDetails = asList(getQuestionGroupInstanceDetail("QG1"), getQuestionGroupInstanceDetail("QG2"));
when(questionnaireServiceFacade.getQuestionGroupInstances(101, "View", "Center")).thenReturn(instanceDetails);
when(request.getAttribute(Constants.CURRENTFLOWKEY)).thenReturn(FLOW_KEY);
when(request.getSession()).thenReturn(session);
when(session.getAttribute(Constants.FLOWMANAGER)).thenReturn(flowManager);
Flow flow = new Flow();
when(flowManager.getFlowWithValidation(FLOW_KEY)).thenReturn(flow);
centerCustAction.setQuestionGroupInstances(questionnaireServiceFacade, request, 101);
assertThat((List<QuestionGroupInstanceDetail>) flow.getObjectFromSession("questionGroupInstances"), is(instanceDetails));
verify(questionnaireServiceFacade, times(1)).getQuestionGroupInstances(101, "View", "Center");
verify(request, times(1)).getAttribute(Constants.CURRENTFLOWKEY);
verify(request, times(1)).getSession();
verify(session, times(1)).getAttribute(Constants.FLOWMANAGER);
}
use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class CenterCustActionTest method getQuestionGroupInstanceDetail.
private QuestionGroupInstanceDetail getQuestionGroupInstanceDetail(String questionGroupTitle) {
QuestionGroupInstanceDetail detail = new QuestionGroupInstanceDetail();
detail.setDateCompleted(Calendar.getInstance().getTime());
detail.setQuestionGroupDetail(getQuestionGroupDetail(questionGroupTitle, asList("red", "green", "blue")));
return detail;
}
Aggregations