use of org.mifos.accounts.productdefinition.business.ProductCategoryBO in project head by mifos.
the class TestObjectFactory method createSavingsProduct.
public static SavingsOfferingBO createSavingsProduct(final String name, final String shortName, final ApplicableTo applicableTo, final Date startDate, final PrdStatus status, final Double recommendedAmount, final RecommendedAmountUnit recommendedAmountUnit, final Double intRate, final Double maxAmtWithdrawl, final Double minAmtForInt, final SavingsType savingsType, final InterestCalcType interestCalculationType, final MeetingBO intCalcMeeting, final MeetingBO intPostMeeting, final Short depGLCode, final Short withGLCode) {
GLCodeEntity depglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, depGLCode);
GLCodeEntity intglCodeEntity = (GLCodeEntity) StaticHibernateUtil.getSessionTL().get(GLCodeEntity.class, withGLCode);
ProductCategoryBO productCategory = (ProductCategoryBO) TestObjectFactory.getObject(ProductCategoryBO.class, SAMPLE_CATEGORY);
PrdApplicableMasterEntity prdApplicableMaster = new PrdApplicableMasterEntity(applicableTo);
SavingsTypeEntity savingsTypeEntity = new SavingsTypeEntity(savingsType);
InterestCalcTypeEntity intCalType = new InterestCalcTypeEntity(interestCalculationType);
RecommendedAmntUnitEntity amountUnit = new RecommendedAmntUnitEntity(recommendedAmountUnit);
SavingsOfferingBO product;
try {
product = new SavingsOfferingBO(TestUtils.makeUserWithLocales(), name, shortName, productCategory, prdApplicableMaster, startDate, null, null, amountUnit, savingsTypeEntity, intCalType, intCalcMeeting, intPostMeeting, TestUtils.createMoney(recommendedAmount), TestUtils.createMoney(maxAmtWithdrawl), TestUtils.createMoney(minAmtForInt), intRate, depglCodeEntity, intglCodeEntity);
} catch (ProductDefinitionException e) {
throw new RuntimeException(e);
} catch (SystemException e) {
throw new RuntimeException(e);
}
PrdStatusEntity prdStatus = testObjectPersistence.retrievePrdStatus(status);
product.setPrdStatus(prdStatus);
return (SavingsOfferingBO) testObjectPersistence.persist(product);
}
Aggregations