Search in sources :

Example 61 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveLoanProductAuditLogs.

@Override
public List<AuditLogDto> retrieveLoanProductAuditLogs(Integer productId) {
    List<AuditLogDto> auditLogDtos = new ArrayList<AuditLogDto>();
    AuditBusinessService auditBusinessService = new AuditBusinessService();
    try {
        List<AuditLogView> auditLogs = auditBusinessService.getAuditLogRecords(EntityType.LOANPRODUCT.getValue(), productId);
        for (AuditLogView auditLogView : auditLogs) {
            auditLogDtos.add(auditLogView.toDto());
        }
        return auditLogDtos;
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : AuditBusinessService(org.mifos.framework.components.audit.business.service.AuditBusinessService) ServiceException(org.mifos.framework.exceptions.ServiceException) ArrayList(java.util.ArrayList) AuditLogView(org.mifos.framework.components.audit.util.helpers.AuditLogView) AuditLogDto(org.mifos.dto.domain.AuditLogDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 62 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveProductCategoryTypes.

@Override
public List<ProductCategoryTypeDto> retrieveProductCategoryTypes() {
    try {
        List<ProductTypeEntity> productCategoryList = new ProductCategoryBusinessService().getProductTypes();
        List<ProductCategoryTypeDto> productCategoryTypeDtoList = new ArrayList<ProductCategoryTypeDto>();
        for (ProductTypeEntity productType : productCategoryList) {
            ProductCategoryTypeDto productCategoryTypeDto = new ProductCategoryTypeDto(productType.getProductTypeID(), productType.getLookUpValue().getLookUpName());
            productCategoryTypeDtoList.add(productCategoryTypeDto);
        }
        return productCategoryTypeDtoList;
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) ArrayList(java.util.ArrayList) ProductCategoryTypeDto(org.mifos.dto.screen.ProductCategoryTypeDto) ProductCategoryBusinessService(org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService) ProductTypeEntity(org.mifos.accounts.productdefinition.business.ProductTypeEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 63 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveSavingsProductAuditLogs.

@Override
public List<AuditLogDto> retrieveSavingsProductAuditLogs(Integer productId) {
    List<AuditLogDto> auditLogDtos = new ArrayList<AuditLogDto>();
    AuditBusinessService auditBusinessService = new AuditBusinessService();
    try {
        List<AuditLogView> auditLogs = auditBusinessService.getAuditLogRecords(EntityType.SAVINGSPRODUCT.getValue(), productId);
        for (AuditLogView auditLogView : auditLogs) {
            auditLogDtos.add(auditLogView.toDto());
        }
        return auditLogDtos;
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : AuditBusinessService(org.mifos.framework.components.audit.business.service.AuditBusinessService) ServiceException(org.mifos.framework.exceptions.ServiceException) ArrayList(java.util.ArrayList) AuditLogView(org.mifos.framework.components.audit.util.helpers.AuditLogView) AuditLogDto(org.mifos.dto.domain.AuditLogDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 64 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveProductCateogry.

@Override
public ProductCategoryDetailsDto retrieveProductCateogry(String globalProductCategoryNumber) {
    ProductCategoryBusinessService service = new ProductCategoryBusinessService();
    try {
        ProductCategoryBO pcBO = service.findByGlobalNum(globalProductCategoryNumber);
        String productTypeName = service.getProductType(pcBO.getProductType().getProductTypeID()).getLookUpValue().getLookUpName();
        ProductCategoryDetailsDto productCategoryDetailsDto = new ProductCategoryDetailsDto(pcBO.getProductCategoryName(), pcBO.getPrdCategoryStatus().getId(), pcBO.getProductType().getProductTypeID(), pcBO.getProductCategoryDesc(), productTypeName);
        return productCategoryDetailsDto;
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : ProductCategoryDetailsDto(org.mifos.dto.screen.ProductCategoryDetailsDto) ServiceException(org.mifos.framework.exceptions.ServiceException) ProductCategoryBO(org.mifos.accounts.productdefinition.business.ProductCategoryBO) ProductCategoryBusinessService(org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 65 with ServiceException

use of org.mifos.framework.exceptions.ServiceException in project head by mifos.

the class CenterServiceFacadeWebTier method retrieveCustomersUnderBranch.

@Override
public List<CustomerDetailDto> retrieveCustomersUnderBranch(Short branchId) {
    List<CustomerDetailDto> customers = null;
    try {
        customers = new ArrayList<CustomerDetailDto>();
        List<PersonnelBO> officers = personnelBusinessService.getActiveLoanOfficersUnderOffice(branchId);
        for (PersonnelBO officer : officers) {
            customers.addAll(retrieveCustomersUnderUser(officer.getPersonnelId()));
        }
    } catch (ServiceException e) {
    }
    return customers;
}
Also used : ServiceException(org.mifos.framework.exceptions.ServiceException) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto)

Aggregations

ServiceException (org.mifos.framework.exceptions.ServiceException)93 PersistenceException (org.mifos.framework.exceptions.PersistenceException)46 MifosRuntimeException (org.mifos.core.MifosRuntimeException)39 Test (org.junit.Test)34 ExpectedException (org.springframework.test.annotation.ExpectedException)29 ArrayList (java.util.ArrayList)24 UserContext (org.mifos.security.util.UserContext)19 AccountBO (org.mifos.accounts.business.AccountBO)17 MifosUser (org.mifos.security.MifosUser)16 LoanBO (org.mifos.accounts.loan.business.LoanBO)15 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)14 AccountException (org.mifos.accounts.exceptions.AccountException)13 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)13 BusinessRuleException (org.mifos.service.BusinessRuleException)11 Date (java.util.Date)8 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)7 BigDecimal (java.math.BigDecimal)6 ProductCategoryBusinessService (org.mifos.accounts.productdefinition.business.service.ProductCategoryBusinessService)6 DateTimeService (org.mifos.framework.util.DateTimeService)6 LocalDate (org.joda.time.LocalDate)5