Search in sources :

Example 11 with StatesInitializationException

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

the class CenterServiceFacadeWebTier method initializeClientStates.

@Override
public void initializeClientStates(String clientGlobalNum) {
    ClientBO client = this.customerDao.findClientBySystemId(clientGlobalNum);
    try {
        List<ListElement> savingsStatesList = new ArrayList<ListElement>();
        AccountStateMachines.getInstance().initializeClientStates();
        List<CustomerStatusEntity> statusList = AccountStateMachines.getInstance().getClientStatusList(client.getCustomerStatus());
        for (CustomerStatusEntity customerState : statusList) {
            savingsStatesList.add(new ListElement(customerState.getId().intValue(), customerState.getName()));
        }
    } catch (StatesInitializationException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ListElement(org.mifos.dto.screen.ListElement) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 12 with StatesInitializationException

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

the class CenterServiceFacadeWebTier method initializeCenterStates.

@Override
public void initializeCenterStates(String centerGlobalNum) {
    CenterBO center = this.customerDao.findCenterBySystemId(centerGlobalNum);
    try {
        List<ListElement> savingsStatesList = new ArrayList<ListElement>();
        AccountStateMachines.getInstance().initializeCenterStates();
        List<CustomerStatusEntity> statusList = AccountStateMachines.getInstance().getCenterStatusList(center.getCustomerStatus());
        for (CustomerStatusEntity customerState : statusList) {
            savingsStatesList.add(new ListElement(customerState.getId().intValue(), customerState.getName()));
        }
    } catch (StatesInitializationException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : ArrayList(java.util.ArrayList) ListElement(org.mifos.dto.screen.ListElement) CenterBO(org.mifos.customers.center.business.CenterBO) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 13 with StatesInitializationException

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

the class CenterServiceFacadeWebTier method initializeGroupStates.

@Override
public void initializeGroupStates(String groupGlobalNum) {
    GroupBO group = this.customerDao.findGroupBySystemId(groupGlobalNum);
    try {
        List<ListElement> savingsStatesList = new ArrayList<ListElement>();
        AccountStateMachines.getInstance().initializeGroupStates();
        List<CustomerStatusEntity> statusList = AccountStateMachines.getInstance().getGroupStatusList(group.getCustomerStatus());
        for (CustomerStatusEntity customerState : statusList) {
            savingsStatesList.add(new ListElement(customerState.getId().intValue(), customerState.getName()));
        }
    } catch (StatesInitializationException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : ArrayList(java.util.ArrayList) ListElement(org.mifos.dto.screen.ListElement) GroupBO(org.mifos.customers.group.business.GroupBO) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 14 with StatesInitializationException

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

the class AccountStateMachines method initializeClientStates.

public void initializeClientStates() throws StatesInitializationException {
    AccountTypes accountType = AccountTypes.CUSTOMER_ACCOUNT;
    CustomerLevel level = CustomerLevel.CLIENT;
    String configName = getConfigurationName(accountType, level);
    try {
        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 : 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 15 with StatesInitializationException

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

the class AccountStateMachines method retrieveNextPossibleCustomerStateForCenter.

private List<CustomerStatusEntity> retrieveNextPossibleCustomerStateForCenter(StateEntity customerStateEntityObj) throws ApplicationException {
    logger.debug("In AccountStateMachines::retrieveNextPossibleCustomerStateForCenter()");
    List<CustomerStatusEntity> stateEntityList = new ArrayList<CustomerStatusEntity>();
    try {
        List<StateEntity> stateList = statesMapForCenter.get(customerStateEntityObj);
        if (null != stateList) {
            for (StateEntity customerStateEntity : stateList) {
                for (CustomerStatusEntity customerStatusEntry : customerStatusListForCenter) {
                    if (customerStatusEntry.sameId(customerStateEntity)) {
                        stateEntityList.add(customerStatusEntry);
                        break;
                    }
                }
            }
        }
        return stateEntityList;
    } catch (Exception e) {
        throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
    }
}
Also used : ArrayList(java.util.ArrayList) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) ServiceException(org.mifos.framework.exceptions.ServiceException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) ApplicationException(org.mifos.framework.exceptions.ApplicationException) StateEntity(org.mifos.application.master.business.StateEntity)

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