use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class LoanAccountAction method viewAndEditAdditionalInformation.
public ActionForward viewAndEditAdditionalInformation(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
Integer entityId = Integer.valueOf(request.getParameter("entityId"));
questionGroupFilter.setLoanOfferingBO(getLoan(entityId).getLoanOffering());
List<QuestionGroupInstanceDetail> questionGroupInstances = createLoanQuestionnaire.getQuestionGroupInstances(request, entityId);
request.getSession().setAttribute(LoanConstants.QUESTION_GROUP_INSTANCES, questionGroupInstances);
ActionForward forward = mapping.findForward(ActionForwards.viewAndEditAdditionalInformation.toString());
return new ActionForward(forward.getPath(), forward.getRedirect());
}
use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class LoanAccountActionTest 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 QuestionnaireMapperImpl method mapToQuestionGroupInstanceDetail.
@Override
public QuestionGroupInstanceDetail mapToQuestionGroupInstanceDetail(QuestionGroupInstance questionGroupInstance) {
QuestionGroupDetail questionGroupDetail = mapToQuestionGroupDetail(questionGroupInstance.getQuestionGroup());
QuestionGroupInstanceDetail questionGroupInstanceDetail = new QuestionGroupInstanceDetail();
questionGroupInstanceDetail.setId(questionGroupInstance.getId());
questionGroupInstanceDetail.setDateCompleted(questionGroupInstance.getDateConducted());
questionGroupInstanceDetail.setQuestionGroupDetail(questionGroupDetail);
mapQuestionResponses(questionGroupInstance.getQuestionGroupResponses(), questionGroupInstanceDetail.getQuestionGroupDetail());
return questionGroupInstanceDetail;
}
use of org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail in project head by mifos.
the class GroupCustActionTest method shouldSetQuestionGroupInstanceDetailsInSession.
@Test
public void shouldSetQuestionGroupInstanceDetailsInSession() throws PageExpiredException {
List<QuestionGroupInstanceDetail> instanceDetails = asList(getQuestionGroupInstanceDetail("QG1"), getQuestionGroupInstanceDetail("QG2"));
when(questionnaireServiceFacade.getQuestionGroupInstances(101, "View", "Group")).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);
groupCustAction.setQuestionGroupInstances(questionnaireServiceFacade, request, 101);
assertThat((List<QuestionGroupInstanceDetail>) flow.getObjectFromSession("questionGroupInstances"), is(instanceDetails));
verify(questionnaireServiceFacade, times(1)).getQuestionGroupInstances(101, "View", "Group");
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 ClientCustActionTest method shouldSetQuestionGroupInstanceDetailsInSession.
@Test
public void shouldSetQuestionGroupInstanceDetailsInSession() throws PageExpiredException {
List<QuestionGroupInstanceDetail> instanceDetails = asList(getQuestionGroupInstanceDetail("QG1"), getQuestionGroupInstanceDetail("QG2"));
when(questionnaireServiceFacade.getQuestionGroupInstances(101, "View", "Client")).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);
clientCustAction.setQuestionGroupInstances(questionnaireServiceFacade, request, 101);
assertThat((List<QuestionGroupInstanceDetail>) flow.getObjectFromSession("questionGroupInstances"), is(instanceDetails));
verify(questionnaireServiceFacade, times(1)).getQuestionGroupInstances(101, "View", "Client");
verify(request, times(1)).getAttribute(Constants.CURRENTFLOWKEY);
verify(request, times(1)).getSession();
verify(session, times(1)).getAttribute(Constants.FLOWMANAGER);
}
Aggregations