Search in sources :

Example 1 with CustomerCheckBoxItemDto

use of org.mifos.dto.screen.CustomerCheckBoxItemDto in project head by mifos.

the class CheckListServiceFacadeWebTier method retreiveAllCustomerCheckLists.

@Override
public List<CustomerCheckBoxItemDto> retreiveAllCustomerCheckLists() {
    try {
        List<CustomerCheckListBO> customerCheckLists = new CheckListBusinessService().retreiveAllCustomerCheckLists();
        List<CustomerCheckBoxItemDto> dtoList = new ArrayList<CustomerCheckBoxItemDto>();
        for (CustomerCheckListBO bo : customerCheckLists) {
            String lookUpName = bo.getCustomerStatus().getLookUpValue() != null ? bo.getCustomerStatus().getLookUpValue().getLookUpName() : null;
            CustomerCheckBoxItemDto dto = new CustomerCheckBoxItemDto(bo.getChecklistId(), bo.getChecklistName(), bo.getChecklistStatus(), null, lookUpName, bo.getCustomerStatus().getId(), bo.getCustomerLevel().getId());
            if (dto.getLookUpName() != null) {
                dto.setName(ApplicationContextProvider.getBean(MessageLookup.class).lookup(dto.getLookUpName()));
            }
            dtoList.add(dto);
        }
        return dtoList;
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) ServiceException(org.mifos.framework.exceptions.ServiceException) ArrayList(java.util.ArrayList) CheckListBusinessService(org.mifos.customers.checklist.business.service.CheckListBusinessService) CustomerCheckBoxItemDto(org.mifos.dto.screen.CustomerCheckBoxItemDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 2 with CustomerCheckBoxItemDto

use of org.mifos.dto.screen.CustomerCheckBoxItemDto in project head by mifos.

the class ChkListAction method deleteExistingStates.

private void deleteExistingStates(List<CheckListStatesView> stateList, boolean isCustomer, String masterTypeId, Short masterEditStateId) {
    if (isCustomer) {
        Short levelId = getShortValue(masterTypeId);
        List<CustomerCheckBoxItemDto> customerCheckLists = filterCustomerCheckListsByLevel(checkListServiceFacade.retreiveAllCustomerCheckLists(), CustomerLevel.getLevel(levelId));
        for (int i = stateList.size() - 1; i >= 0; i--) {
            Short state = stateList.get(i).getStateId();
            for (CustomerCheckBoxItemDto customer : customerCheckLists) {
                if (state.equals(customer.getCustomerStatusId()) && !state.equals(masterEditStateId)) {
                    stateList.remove(i);
                }
            }
        }
    } else {
        Short prdTypeId = getShortValue(masterTypeId);
        List<AccountCheckBoxItemDto> accountCheckLists = filterAccountCheckListsByProductType(checkListServiceFacade.retreiveAllAccountCheckLists(), ProductType.fromInt((int) prdTypeId));
        for (int i = stateList.size() - 1; i >= 0; i--) {
            Short state = stateList.get(i).getStateId();
            for (AccountCheckBoxItemDto account : accountCheckLists) {
                if (state.equals(account.getAccountStateId()) && !state.equals(masterEditStateId)) {
                    stateList.remove(i);
                }
            }
        }
    }
}
Also used : AccountCheckBoxItemDto(org.mifos.dto.screen.AccountCheckBoxItemDto) CustomerCheckBoxItemDto(org.mifos.dto.screen.CustomerCheckBoxItemDto)

Aggregations

CustomerCheckBoxItemDto (org.mifos.dto.screen.CustomerCheckBoxItemDto)2 ArrayList (java.util.ArrayList)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 CustomerCheckListBO (org.mifos.customers.checklist.business.CustomerCheckListBO)1 CheckListBusinessService (org.mifos.customers.checklist.business.service.CheckListBusinessService)1 AccountCheckBoxItemDto (org.mifos.dto.screen.AccountCheckBoxItemDto)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1