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);
}
}
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);
}
}
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;
}
Aggregations