Search in sources :

Example 1 with StatesInitializationException

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

the class LoanAccountServiceFacadeWebTier method retrieveAccountStatuses.

@Override
public AccountStatusDto retrieveAccountStatuses(Long loanAccountId) {
    LoanBO loanAccount = this.loanDao.findById(loanAccountId.intValue());
    try {
        List<ListElement> loanStatesList = new ArrayList<ListElement>();
        AccountStateMachines.getInstance().initializeLoanStates();
        List<AccountStateEntity> statusList = AccountStateMachines.getInstance().getLoanStatusList(loanAccount.getAccountState());
        for (AccountStateEntity accountState : statusList) {
            loanStatesList.add(new ListElement(accountState.getId().intValue(), accountState.getName()));
        }
        return new AccountStatusDto(loanStatesList);
    } catch (StatesInitializationException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : AccountStatusDto(org.mifos.dto.domain.AccountStatusDto) ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) ValueListElement(org.mifos.dto.domain.ValueListElement) ListElement(org.mifos.dto.screen.ListElement) StatesInitializationException(org.mifos.framework.exceptions.StatesInitializationException) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 2 with StatesInitializationException

use of org.mifos.framework.exceptions.StatesInitializationException 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 3 with StatesInitializationException

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

the class AccountStateMachines method retrieveNextPossibleAccountStateObjectsForLoan.

private List<AccountStateEntity> retrieveNextPossibleAccountStateObjectsForLoan(StateEntity accountStateEntityObj) throws ApplicationException {
    logger.debug("In AccountStateMachines::retrieveNextPossibleAccountStateObjectsForLoan()");
    List<AccountStateEntity> stateEntityList = new ArrayList<AccountStateEntity>();
    try {
        List<StateEntity> stateList = statesMapForLoan.get(accountStateEntityObj);
        if (null != stateList) {
            for (StateEntity accountStateEntity : stateList) {
                for (AccountStateEntity accountStateEnty : accountStateEntityListForLoan) {
                    if (accountStateEntity.sameId(accountStateEnty)) {
                        stateEntityList.add(accountStateEnty);
                        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) 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)

Example 4 with StatesInitializationException

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

the class AccountStateMachines method retrieveNextPossibleCustomerStateForClient.

private List<CustomerStatusEntity> retrieveNextPossibleCustomerStateForClient(StateEntity customerStateEntityObj) throws ApplicationException {
    logger.debug("In AccountStateMachines::retrieveNextPossibleCustomerStateForClient()");
    List<CustomerStatusEntity> stateEntityList = new ArrayList<CustomerStatusEntity>();
    try {
        List<StateEntity> stateList = statesMapForClient.get(customerStateEntityObj);
        if (null != stateList) {
            for (StateEntity customerStateEntity : stateList) {
                for (CustomerStatusEntity customerStatusEntry : customerStatusListForClient) {
                    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)

Example 5 with StatesInitializationException

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

the class AccountStateMachines method retrieveNextPossibleCustomerStateForGroup.

private List<CustomerStatusEntity> retrieveNextPossibleCustomerStateForGroup(StateEntity customerStateEntityObj) throws ApplicationException {
    logger.debug("In AccountStateMachines::retrieveNextPossibleCustomerStateForGroup()");
    List<CustomerStatusEntity> stateEntityList = new ArrayList<CustomerStatusEntity>();
    try {
        List<StateEntity> stateList = statesMapForGroup.get(customerStateEntityObj);
        if (null != stateList) {
            for (StateEntity customerStateEntity : stateList) {
                for (CustomerStatusEntity customerStatusEntry : customerStatusListForGroup) {
                    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