Search in sources :

Example 6 with InterestCalcTypeEntity

use of org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity 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);
}
Also used : MifosRuntimeException(org.mifos.core.MifosRuntimeException) SavingsTypeEntity(org.mifos.accounts.productdefinition.business.SavingsTypeEntity) SystemException(org.mifos.framework.exceptions.SystemException) ProductCategoryBO(org.mifos.accounts.productdefinition.business.ProductCategoryBO) InterestCalcTypeEntity(org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity) ProductDefinitionException(org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) PrdStatusEntity(org.mifos.accounts.productdefinition.business.PrdStatusEntity) RecommendedAmntUnitEntity(org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity) PrdApplicableMasterEntity(org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)

Aggregations

InterestCalcTypeEntity (org.mifos.accounts.productdefinition.business.InterestCalcTypeEntity)6 RecommendedAmntUnitEntity (org.mifos.accounts.productdefinition.business.RecommendedAmntUnitEntity)4 SavingsTypeEntity (org.mifos.accounts.productdefinition.business.SavingsTypeEntity)4 ArrayList (java.util.ArrayList)3 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)3 PrdApplicableMasterEntity (org.mifos.accounts.productdefinition.business.PrdApplicableMasterEntity)3 PrdStatusEntity (org.mifos.accounts.productdefinition.business.PrdStatusEntity)3 ProductCategoryBO (org.mifos.accounts.productdefinition.business.ProductCategoryBO)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 ListElement (org.mifos.dto.screen.ListElement)2 SavingsProductReferenceDto (org.mifos.dto.screen.SavingsProductReferenceDto)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 SystemException (org.mifos.framework.exceptions.SystemException)2 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 DateTime (org.joda.time.DateTime)1 FinancialBusinessService (org.mifos.accounts.financial.business.service.FinancialBusinessService)1 PenaltyBO (org.mifos.accounts.penalties.business.PenaltyBO)1 SavingsPrdBusinessService (org.mifos.accounts.productdefinition.business.service.SavingsPrdBusinessService)1