LoanAccountAction extends AccountAppAction implements QuestionnaireAction { private void setQuestionGroupInstances(HttpServletRequest request, LoanBO loanBO) throws PageExpiredException { QuestionnaireServiceFacade questionnaireServiceFacade = questionnaireServiceFacadeLocator.getService(request); boolean containsQGForCloseLoan = false; if (questionnaireServiceFacade != null) { setQuestionGroupInstances(questionnaireServiceFacade, request, loanBO.getAccountId()); if (loanBO.getAccountState().getId().equals(AccountState.LOAN_CLOSED_RESCHEDULED.getValue()) || loanBO.getAccountState().getId().equals(AccountState.LOAN_CLOSED_WRITTEN_OFF.getValue())) { containsQGForCloseLoan = questionnaireServiceFacade.getQuestionGroupInstances(loanBO.getAccountId(), "Close", "Loan").size() > 0; } } SessionUtils.removeThenSetAttribute("containsQGForCloseLoan", containsQGForCloseLoan, request); } LoanAccountAction();  LoanAccountAction(final ConfigurationBusinessService configService,
                             final LoanBusinessService loanBusinessService, final GlimLoanUpdater glimLoanUpdater,
                             final LoanPrdBusinessService loanPrdBusinessService,
                             final ConfigurationPersistence configurationPersistence,
                             final AccountBusinessService accountBusinessService,
                             final GroupLoanAccountServiceFacade groupLoanAccountServiceFacade,
                             final InformationOrderServiceFacade informationOrderServiceFacade); @Deprecated  LoanAccountAction(final LoanBusinessService loanBusinessService, final ConfigurationBusinessService configService,
                      final GlimLoanUpdater glimLoanUpdater); @Deprecated private  LoanAccountAction(final ConfigurationBusinessService configService,
                              final LoanBusinessService loanBusinessService, final GlimLoanUpdater glimLoanUpdater); ActionForward viewAndEditAdditionalInformation(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getInstallmentDetails(final ActionMapping mapping,
                                               @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                               @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getAllActivity(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                        final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward forwardWaiveCharge(final ActionMapping mapping,
                                            @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                            @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(saveToken = true) ActionForward get(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                             @SuppressWarnings("unused") final HttpServletResponse response); void setQuestionGroupInstances(QuestionnaireServiceFacade questionnaireServiceFacade, HttpServletRequest request, Integer loanAccountId); @TransactionDemarcate(saveToken = true) ActionForward getLoanRepaymentSchedule(final ActionMapping mapping,
                                                  final ActionForm form, final HttpServletRequest request,
                                                  @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward viewOriginalSchedule(final ActionMapping mapping,
                                              @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                              @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward viewStatusHistory(final ActionMapping mapping,
                                           @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                           @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward validate(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                  @SuppressWarnings("unused") final HttpServletResponse response); ActionForward redoLoanBegin(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                       @SuppressWarnings("unused") final HttpServletRequest request,
                                       @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); static void setSessionAtributeForGLIM(final HttpServletRequest request, LoanBO loanBO); @TransactionDemarcate(joinToken = true) ActionForward managePrevious(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                        final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward managePreview(final ActionMapping mapping, final ActionForm form,
                                       final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) ActionForward cancel(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                @SuppressWarnings("unused") final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) ActionForward update(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) @Override ActionForward captureQuestionResponses(final ActionMapping mapping, final ActionForm form,
                                                  final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) @Override ActionForward editQuestionResponses(
            final ActionMapping mapping, final ActionForm form,
            final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); void setCustomerDao(CustomerDao customerDao); @TransactionDemarcate(saveToken = true) ActionForward getGroupLoanAccountDetails(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                             @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getGroupLoanRepaymentSchedule(final ActionMapping mapping,
                                                  final ActionForm form, final HttpServletRequest request,
                                                  @SuppressWarnings("unused") final HttpServletResponse response); ActionForward getDetails(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
            @SuppressWarnings("unused") final HttpServletResponse response); static final String CUSTOMER_ID; static final String ACCOUNT_ID; static final String GLOBAL_ACCOUNT_NUM; }
@SuppressWarnings("unchecked") @Test public void shouldSetQuestionGroupInstanceDetailsInSession() throws PageExpiredException { List<QuestionGroupInstanceDetail> instanceDetails = asList(getQuestionGroupInstanceDetail("QG1"), getQuestionGroupInstanceDetail("QG2")); when(questionnaireServiceFacade.getQuestionGroupInstances(101, "View", "Loan")).thenReturn(instanceDetails); loanAccountAction.setQuestionGroupInstances(questionnaireServiceFacade, request, 101); assertThat((List<QuestionGroupInstanceDetail>) flow.getObjectFromSession("questionGroupInstances"), is(instanceDetails)); verify(questionnaireServiceFacade, times(1)).getQuestionGroupInstances(101, "View", "Loan"); verify(request, times(1)).getAttribute(Constants.CURRENTFLOWKEY); verify(request, times(1)).getSession(); verify(session, times(1)).getAttribute(Constants.FLOWMANAGER); }