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);
}
}
Aggregations