Search in sources :

Example 6 with QuestionGroupReference

use of org.mifos.accounts.productdefinition.business.QuestionGroupReference in project head by mifos.

the class LoanPrdAction method setSelectedQuestionGroupsOnSession.

// Intentionally made public to aid testing !!!
public void setSelectedQuestionGroupsOnSession(HttpServletRequest request, LoanOfferingBO loanOffering, QuestionnaireServiceFacade questionnaireServiceFacade) throws PageExpiredException {
    Set<QuestionGroupReference> questionGroupReferences = loanOffering.getQuestionGroups();
    if (questionnaireServiceFacade != null && CollectionUtils.isNotEmpty(questionGroupReferences)) {
        List<QuestionGroupDetail> questionGroupDetails = new ArrayList<QuestionGroupDetail>();
        for (QuestionGroupReference questionGroupReference : questionGroupReferences) {
            Integer questionGroupId = questionGroupReference.getQuestionGroupId();
            QuestionGroupDetail questionGroupDetail = questionnaireServiceFacade.getQuestionGroupDetailForLoanPrd(questionGroupId);
            if (questionGroupDetail != null && questionGroupDetail.isActive()) {
                questionGroupDetails.add(questionGroupDetail);
            }
        }
        SessionUtils.setCollectionAttribute(ProductDefinitionConstants.SELECTEDQGLIST, questionGroupDetails, request);
    }
}
Also used : QuestionGroupReference(org.mifos.accounts.productdefinition.business.QuestionGroupReference) QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ArrayList(java.util.ArrayList)

Example 7 with QuestionGroupReference

use of org.mifos.accounts.productdefinition.business.QuestionGroupReference in project head by mifos.

the class QGFlowsServiceImpl method applyToAllLoanProducts.

@Override
public void applyToAllLoanProducts(Integer questionGroupId) throws SystemException {
    LoanPrdBusinessService loanPrdBusinessService = new LoanPrdBusinessService();
    try {
        List<LoanOfferingBO> offerings = loanPrdBusinessService.getAllLoanOfferings((short) 1);
        if (offerings.size() > 0) {
            QuestionGroupReference questionGroupReference = new QuestionGroupReference();
            questionGroupReference.setQuestionGroupId(questionGroupId);
            for (LoanOfferingBO offering : offerings) {
                offering.getQuestionGroups().add(questionGroupReference);
                offering.save();
            }
            StaticHibernateUtil.commitTransaction();
        }
    } catch (ServiceException e) {
        throw new SystemException(e);
    } catch (ProductDefinitionException e) {
        throw new SystemException(e);
    }
}
Also used : QuestionGroupReference(org.mifos.accounts.productdefinition.business.QuestionGroupReference) ServiceException(org.mifos.framework.exceptions.ServiceException) SystemException(org.mifos.framework.exceptions.SystemException) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) LoanPrdBusinessService(org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO)

Example 8 with QuestionGroupReference

use of org.mifos.accounts.productdefinition.business.QuestionGroupReference in project head by mifos.

the class QuestionGroupFilterForLoanTest method makeQuestionGroupRef.

private QuestionGroupReference makeQuestionGroupRef(int questionGroupId) {
    QuestionGroupReference questionGroupReference = new QuestionGroupReference();
    questionGroupReference.setQuestionGroupId(questionGroupId);
    return questionGroupReference;
}
Also used : QuestionGroupReference(org.mifos.accounts.productdefinition.business.QuestionGroupReference)

Aggregations

QuestionGroupReference (org.mifos.accounts.productdefinition.business.QuestionGroupReference)8 ArrayList (java.util.ArrayList)4 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)4 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 List (java.util.List)1 Test (org.junit.Test)1 LoanPrdBusinessService (org.mifos.accounts.productdefinition.business.service.LoanPrdBusinessService)1 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)1 LoanProductBuilder (org.mifos.domain.builders.LoanProductBuilder)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 SystemException (org.mifos.framework.exceptions.SystemException)1