Search in sources :

Example 1 with CustomerLevel

use of org.mifos.customers.api.CustomerLevel in project head by mifos.

the class CheckListServiceFacadeWebTier method createCustomerChecklist.

@Override
public void createCustomerChecklist(Short levelId, Short stateId, String checklistName, List<String> checklistDetails) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(user);
    CustomerLevel level = CustomerLevel.getLevel(levelId);
    CustomerLevelEntity customerLevelEntity = new CustomerLevelEntity(level);
    CustomerStatusEntity customerStatusEntity = new CustomerStatusEntity(stateId);
    try {
        hibernateTransactionHelper.startTransaction();
        CustomerCheckListBO customerCheckListBO = new CustomerCheckListBO(customerLevelEntity, customerStatusEntity, checklistName, CheckListConstants.STATUS_ACTIVE, checklistDetails, userContext.getLocaleId(), userContext.getId());
        customerDao.save(customerCheckListBO);
        hibernateTransactionHelper.commitTransaction();
    } catch (CheckListException e) {
        hibernateTransactionHelper.rollbackTransaction();
        throw new BusinessRuleException(e.getKey(), e);
    } finally {
        hibernateTransactionHelper.closeSession();
    }
}
Also used : CustomerLevel(org.mifos.customers.api.CustomerLevel) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) BusinessRuleException(org.mifos.service.BusinessRuleException) UserContext(org.mifos.security.util.UserContext) CustomerLevelEntity(org.mifos.customers.business.CustomerLevelEntity) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) CheckListException(org.mifos.customers.checklist.exceptions.CheckListException)

Example 2 with CustomerLevel

use of org.mifos.customers.api.CustomerLevel in project head by mifos.

the class CenterServiceFacadeWebTier method retrieveCustomerStatusDetails.

@Override
public CustomerStatusDetailDto retrieveCustomerStatusDetails(Short newStatusId, Short flagIdValue, Short customerLevelId) {
    CustomerLevel customerLevel = CustomerLevel.getLevel(customerLevelId);
    CustomerStatus customerStatus = CustomerStatus.fromInt(newStatusId);
    CustomerStatusFlag statusFlag = null;
    if (customerStatus.isCustomerCancelledOrClosed()) {
        statusFlag = CustomerStatusFlag.getStatusFlag(flagIdValue);
    }
    String statusName = AccountStateMachines.getInstance().getCustomerStatusName(customerStatus, customerLevel);
    String flagName = AccountStateMachines.getInstance().getCustomerFlagName(statusFlag, customerLevel);
    return new CustomerStatusDetailDto(statusName, flagName);
}
Also used : CustomerLevel(org.mifos.customers.api.CustomerLevel) CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) CustomerStatusFlag(org.mifos.customers.util.helpers.CustomerStatusFlag) CustomerStatus(org.mifos.customers.util.helpers.CustomerStatus)

Example 3 with CustomerLevel

use of org.mifos.customers.api.CustomerLevel in project head by mifos.

the class CustomerSearchServiceFacadeWebTier method getAvailibleCustomerStates.

@Override
public Map<String, ArrayList<CustomerStatusDetailDto>> getAvailibleCustomerStates() throws PersistenceException {
    HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
    for (CustomerLevel customerLevel : CustomerLevel.values()) {
        List<CustomerStatusEntity> states = new CustomerPersistence().retrieveAllCustomerStatusList(customerLevel.getValue());
        ArrayList<CustomerStatusDetailDto> statesDtos = new ArrayList<CustomerStatusDetailDto>();
        for (CustomerStatusEntity customerStatusEntity : states) {
            CustomerStatusDetailDto customerStatusDetailDto = new CustomerStatusDetailDto(customerStatusEntity.getId().toString(), customerStatusEntity.getName(), null);
            statesDtos.add(customerStatusDetailDto);
        }
        customerStates.put(customerLevel.toString(), statesDtos);
    }
    return customerStates;
}
Also used : CustomerLevel(org.mifos.customers.api.CustomerLevel) CustomerStatusDetailDto(org.mifos.dto.screen.CustomerStatusDetailDto) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity)

Example 4 with CustomerLevel

use of org.mifos.customers.api.CustomerLevel in project head by mifos.

the class AccountStateMachines method initializeLoanStates.

public void initializeLoanStates() throws StatesInitializationException {
    AccountTypes accountType = AccountTypes.LOAN_ACCOUNT;
    CustomerLevel level = null;
    String configName = getConfigurationName(accountType, level);
    try {
        statesMapForLoan = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_LOAN, configName);
        accountStateEntityListForLoan = retrieveAllAccountStateList(accountType);
        removeLoanReversalFlagForCancelState();
        populateLoanStatesViewMap();
    } catch (Exception e) {
        throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
    }
}
Also used : CustomerLevel(org.mifos.customers.api.CustomerLevel) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) AccountTypes(org.mifos.accounts.util.helpers.AccountTypes) ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) ApplicationException(org.mifos.framework.exceptions.ApplicationException)

Example 5 with CustomerLevel

use of org.mifos.customers.api.CustomerLevel in project head by mifos.

the class AccountStateMachines method initializeSavingsStates.

public void initializeSavingsStates() throws StatesInitializationException {
    AccountTypes accountType = AccountTypes.SAVINGS_ACCOUNT;
    CustomerLevel level = null;
    String configName = getConfigurationName(accountType, level);
    try {
        statesMapForSavings = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_SAVINGS, configName);
        accountStateEntityListForSavings = retrieveAllAccountStateList(accountType);
        populateSavingsStatesViewMap();
    } catch (Exception e) {
        throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
    }
}
Also used : CustomerLevel(org.mifos.customers.api.CustomerLevel) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) AccountTypes(org.mifos.accounts.util.helpers.AccountTypes) ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) ApplicationException(org.mifos.framework.exceptions.ApplicationException)

Aggregations

CustomerLevel (org.mifos.customers.api.CustomerLevel)12 ServiceException (org.mifos.framework.exceptions.ServiceException)8 ApplicationException (org.mifos.framework.exceptions.ApplicationException)7 AccountTypes (org.mifos.accounts.util.helpers.AccountTypes)5 PersistenceException (org.mifos.framework.exceptions.PersistenceException)5 StatesInitializationException (org.mifos.framework.exceptions.StatesInitializationException)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 MifosUser (org.mifos.security.MifosUser)4 UserContext (org.mifos.security.util.UserContext)4 AccountBO (org.mifos.accounts.business.AccountBO)3 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)3 BusinessRuleException (org.mifos.service.BusinessRuleException)3 HashMap (java.util.HashMap)2 AccountPenaltiesEntity (org.mifos.accounts.business.AccountPenaltiesEntity)2 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)2 LoanBO (org.mifos.accounts.loan.business.LoanBO)2 PenaltyBO (org.mifos.accounts.penalties.business.PenaltyBO)2 RatePenaltyBO (org.mifos.accounts.penalties.business.RatePenaltyBO)2 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)2