Search in sources :

Example 16 with StatesInitializationException

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

the class AccountStateMachines method initialize.

public void initialize(AccountTypes accountType, CustomerLevel level) throws StatesInitializationException {
    logger.debug("In AccountStateMachines::initialize()");
    String configName = getConfigurationName(accountType, level);
    try {
        if (accountType.equals(AccountTypes.LOAN_ACCOUNT)) {
            statesMapForLoan = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_LOAN, configName);
            accountStateEntityListForLoan = retrieveAllAccountStateList(accountType);
            removeLoanReversalFlagForCancelState();
            populateLoanStatesViewMap();
        } else if (accountType.equals(AccountTypes.SAVINGS_ACCOUNT)) {
            statesMapForSavings = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_SAVINGS, configName);
            accountStateEntityListForSavings = retrieveAllAccountStateList(accountType);
            populateSavingsStatesViewMap();
        } else if (accountType.equals(AccountTypes.CUSTOMER_ACCOUNT)) {
            if (level.equals(CustomerLevel.CENTER)) {
                statesMapForCenter = loadMap(CustomerConstants.TRANSITION_CONFIG_FILE_PATH_CENTER, configName);
                customerStatusListForCenter = retrieveAllCustomerStatusList(level);
                populateCenterStatesViewMap();
            } else if (level.equals(CustomerLevel.GROUP)) {
                statesMapForGroup = loadMap(CustomerConstants.TRANSITION_CONFIG_FILE_PATH_GROUP, configName);
                customerStatusListForGroup = retrieveAllCustomerStatusList(level);
                populateGroupStatesViewMap();
            } else if (level.equals(CustomerLevel.CLIENT)) {
                statesMapForClient = loadMap(CustomerConstants.TRANSITION_CONFIG_FILE_PATH_CLIENT, configName);
                customerStatusListForClient = retrieveAllCustomerStatusList(level);
                populateClientStatesViewMap();
            }
        }
    } catch (Exception e) {
        throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
    }
}
Also used : StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) 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

StatesInitializationException (org.mifos.framework.exceptions.StatesInitializationException)16 ApplicationException (org.mifos.framework.exceptions.ApplicationException)11 PersistenceException (org.mifos.framework.exceptions.PersistenceException)11 ServiceException (org.mifos.framework.exceptions.ServiceException)11 ArrayList (java.util.ArrayList)10 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)6 AccountTypes (org.mifos.accounts.util.helpers.AccountTypes)5 StateEntity (org.mifos.application.master.business.StateEntity)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 CustomerLevel (org.mifos.customers.api.CustomerLevel)5 ListElement (org.mifos.dto.screen.ListElement)5 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)2 AccountStatusDto (org.mifos.dto.domain.AccountStatusDto)2 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)1 CenterBO (org.mifos.customers.center.business.CenterBO)1 ClientBO (org.mifos.customers.client.business.ClientBO)1 GroupBO (org.mifos.customers.group.business.GroupBO)1 ValueListElement (org.mifos.dto.domain.ValueListElement)1 ChangeAccountStatusDto (org.mifos.dto.screen.ChangeAccountStatusDto)1