use of org.mifos.accounts.productdefinition.business.ProductTypeEntity in project head by mifos.
the class ProductCategoryPersistenceIntegrationTest method testGetProductTypes.
@Test
public void testGetProductTypes() throws Exception {
List<ProductTypeEntity> productTypeList = legacyProductCategoryDao.getProductTypes();
Assert.assertEquals(2, productTypeList.size());
for (ProductTypeEntity productTypeEntity : productTypeList) {
if (productTypeEntity.getType() == ProductType.LOAN) {
Assert.assertEquals("Loan", productTypeEntity.getName());
} else {
//Assert.assertEquals("Margin Money",productTypeEntity.getName());
Assert.assertEquals("Savings", productTypeEntity.getName());
}
}
}
use of org.mifos.accounts.productdefinition.business.ProductTypeEntity in project head by mifos.
the class SavingsProductDaoHibernateIntegrationTest method testShouldFindSavingsProductConfiguration.
@Test
public void testShouldFindSavingsProductConfiguration() {
// exercise test
ProductTypeEntity productType = savingsProductDao.findSavingsProductConfiguration();
assertThat(productType, is(notNullValue()));
assertThat(productType.getType(), is(ProductType.SAVINGS));
}
use of org.mifos.accounts.productdefinition.business.ProductTypeEntity in project head by mifos.
the class ProductCategoryBusinessServiceIntegrationTest method testGetProductTypes.
@Test
public void testGetProductTypes() throws Exception {
UserContext context = TestUtils.makeUser();
List<ProductTypeEntity> productTypeList = productCategoryBusinessService.getProductTypes();
Assert.assertEquals(2, productTypeList.size());
for (ProductTypeEntity productTypeEntity : productTypeList) {
if (productTypeEntity.getProductTypeID().equals(ProductType.LOAN.getValue())) {
Assert.assertEquals("Loan", productTypeEntity.getName());
} else {
//Assert.assertEquals("Margin Money",productTypeEntity.getName());
Assert.assertEquals("Savings", productTypeEntity.getName());
}
}
}
use of org.mifos.accounts.productdefinition.business.ProductTypeEntity in project head by mifos.
the class LoanProductDaoHibernateIntegrationTest method testShouldFindLoanProductConfiguration.
@Test
public void testShouldFindLoanProductConfiguration() {
// exercise test
ProductTypeEntity productType = loanProductDao.findLoanProductConfiguration();
assertThat(productType, is(notNullValue()));
assertThat(productType.getType(), is(ProductType.LOAN));
}
use of org.mifos.accounts.productdefinition.business.ProductTypeEntity in project head by mifos.
the class CheckListServiceFacadeWebTier method createAccountChecklist.
@Override
public void createAccountChecklist(Short productId, Short stateId, String checklistName, List<String> checklistDetails) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
try {
ProductTypeEntity productTypeEntity = null;
for (ProductTypeEntity prdTypeEntity : new ProductCategoryBusinessService().getProductTypes()) {
if (productId.equals(prdTypeEntity.getProductTypeID())) {
productTypeEntity = prdTypeEntity;
break;
}
}
hibernateTransactionHelper.startTransaction();
AccountStateEntity accountStateEntity = new AccountStateEntity(AccountState.fromShort(stateId));
AccountCheckListBO accountCheckListBO = new AccountCheckListBO(productTypeEntity, accountStateEntity, checklistName, CheckListConstants.STATUS_ACTIVE, checklistDetails, userContext.getLocaleId(), userContext.getId());
customerDao.save(accountCheckListBO);
hibernateTransactionHelper.commitTransaction();
} catch (ServiceException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} catch (CheckListException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
Aggregations