Search in sources :

Example 1 with Criteria

use of org.mifos.accounts.loan.struts.action.Criteria in project head by mifos.

the class QuestionnaireFlowAdapter method getQuestionGroups.

private List<QuestionGroupDetail> getQuestionGroups(HttpServletRequest request) {
    QuestionnaireServiceFacade questionnaireServiceFacade = serviceLocator.getService(request);
    Criteria<QuestionGroupDetail> criteria = new Criteria<QuestionGroupDetail>() {

        @Override
        public QuestionGroupDetail filter(Integer questionGroupId, List<QuestionGroupDetail> questionGroupDetails) {
            QuestionGroupDetail result = null;
            for (QuestionGroupDetail questionGroupDetail : questionGroupDetails) {
                if (questionGroupId.equals(questionGroupDetail.getId())) {
                    result = questionGroupDetail;
                    break;
                }
            }
            return result;
        }
    };
    return questionnaireServiceFacade != null ? questionGroupFilter.doFilter(questionnaireServiceFacade.getQuestionGroups(event, source), criteria) : null;
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ArrayList(java.util.ArrayList) List(java.util.List) Criteria(org.mifos.accounts.loan.struts.action.Criteria) QuestionnaireServiceFacade(org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade)

Example 2 with Criteria

use of org.mifos.accounts.loan.struts.action.Criteria in project head by mifos.

the class QuestionnaireFlowAdapter method getQuestionGroupInstances.

public List<QuestionGroupInstanceDetail> getQuestionGroupInstances(HttpServletRequest request, Integer entityId) {
    QuestionnaireServiceFacade questionnaireServiceFacade = serviceLocator.getService(request);
    Criteria<QuestionGroupInstanceDetail> criteria = new Criteria<QuestionGroupInstanceDetail>() {

        @Override
        public QuestionGroupInstanceDetail filter(Integer questionGroupId, List<QuestionGroupInstanceDetail> questionGroupInstanceDetails) {
            QuestionGroupInstanceDetail result = null;
            for (QuestionGroupInstanceDetail questionGroupInstanceDetail : questionGroupInstanceDetails) {
                if (questionGroupId.equals(questionGroupInstanceDetail.getQuestionGroupDetail().getId())) {
                    result = questionGroupInstanceDetail;
                    break;
                }
            }
            return result;
        }
    };
    return questionnaireServiceFacade != null ? questionGroupFilter.doFilter(questionnaireServiceFacade.getQuestionGroupInstancesWithUnansweredQuestionGroups(entityId, event, source), criteria) : new ArrayList<QuestionGroupInstanceDetail>();
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Criteria(org.mifos.accounts.loan.struts.action.Criteria) QuestionnaireServiceFacade(org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade) QuestionGroupInstanceDetail(org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 Criteria (org.mifos.accounts.loan.struts.action.Criteria)2 QuestionnaireServiceFacade (org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade)2 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)1 QuestionGroupInstanceDetail (org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail)1