Search in sources :

Example 16 with ConfigurationException

use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.

the class ProcessFlowRules method initSavingsPendingApprovalState.

private static void initSavingsPendingApprovalState() throws ConfigurationException {
    LegacyAccountDao ap = ApplicationContextProvider.getBean(LegacyAccountDao.class);
    AccountStateEntity ase = ap.loadPersistentObject(AccountStateEntity.class, AccountState.SAVINGS_PENDING_APPROVAL.getValue());
    boolean fromDb = isSavingPendingApprovalStateEnabledOnDatabaseConfig(ase);
    boolean fromCfg = isSavingsPendingApprovalStateEnabled();
    if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
        int count = ApplicationContextProvider.getBean(LegacyLoanDao.class).countOfSavingsAccounts();
        if (count > 0) {
            String errMsg = getBadOverrideMsg(SAVINGS_PENDING_APPROVAL, "Records for savings accounts in the 'pending approval' state" + " may already exist.");
            throw new ConfigurationException(errMsg);
        }
        makeDatabaseConfigurationMatchPropertiesFileConfiguration(ap, ase, fromCfg);
    }
}
Also used : LegacyAccountDao(org.mifos.accounts.persistence.LegacyAccountDao) ConfigurationException(org.mifos.config.exceptions.ConfigurationException) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) LegacyLoanDao(org.mifos.accounts.loan.persistance.LegacyLoanDao)

Example 17 with ConfigurationException

use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.

the class ProcessFlowRules method initGroupPendingApprovalState.

private static void initGroupPendingApprovalState() throws ConfigurationException {
    CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
    CustomerStatusEntity cse = customerDao.findGroupPendingStatus();
    boolean fromDb = isGroupPendingApprovalStateEnabledOnDatabaseConfiguration(cse);
    boolean fromCfg = isGroupPendingApprovalStateEnabled();
    if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
        int count = customerDao.countOfGroups();
        if (count > 0) {
            final String errMsg = getBadOverrideMsg(GROUP_PENDING_APPROVAL, "Records for groups in the 'pending approval' state" + " may already exist.");
            throw new ConfigurationException(errMsg);
        }
        makeDatabaseConfigurationMatchPropertiesFileConfiguration(customerDao, cse, fromCfg);
    }
}
Also used : ConfigurationException(org.mifos.config.exceptions.ConfigurationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) CustomerDao(org.mifos.customers.persistence.CustomerDao)

Example 18 with ConfigurationException

use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.

the class ProcessFlowRules method initClientPendingApprovalState.

private static void initClientPendingApprovalState() throws ConfigurationException {
    CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
    CustomerStatusEntity cse = customerDao.findClientPendingStatus();
    boolean fromDb = isClientPendingApprovalStateEnabledOnDatabaseConfiguration(cse);
    boolean fromCfg = isClientPendingApprovalStateEnabled();
    if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
        int count = customerDao.countOfClients();
        if (count > 0) {
            final String errMsg = getBadOverrideMsg(CLIENT_PENDING_APPROVAL, "Records for clients in the 'pending approval' state" + " may already exist.");
            throw new ConfigurationException(errMsg);
        }
        makeDatabaseConfigurationMatchPropertiesFileConfiguration(customerDao, cse, fromCfg);
    }
}
Also used : ConfigurationException(org.mifos.config.exceptions.ConfigurationException) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity) CustomerDao(org.mifos.customers.persistence.CustomerDao)

Aggregations

ConfigurationException (org.mifos.config.exceptions.ConfigurationException)18 MifosConfigurationManager (org.mifos.config.business.MifosConfigurationManager)8 IOException (java.io.IOException)3 LegacyAccountDao (org.mifos.accounts.persistence.LegacyAccountDao)3 PersistenceException (org.mifos.framework.exceptions.PersistenceException)3 ArrayList (java.util.ArrayList)2 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)2 FinancialException (org.mifos.accounts.financial.exceptions.FinancialException)2 LegacyLoanDao (org.mifos.accounts.loan.persistance.LegacyLoanDao)2 AccountSearchResultsDto (org.mifos.accounts.util.helpers.AccountSearchResultsDto)2 MifosRuntimeException (org.mifos.core.MifosRuntimeException)2 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)2 CustomerDao (org.mifos.customers.persistence.CustomerDao)2 CustomerSearchResultDto (org.mifos.dto.domain.CustomerSearchResultDto)2 HibernateSearchException (org.mifos.framework.exceptions.HibernateSearchException)2 QueryResult (org.mifos.framework.hibernate.helper.QueryResult)2 InputStream (java.io.InputStream)1 Iterator (java.util.Iterator)1 Locale (java.util.Locale)1 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)1