Search in sources :

Example 31 with MifosConfigurationManager

use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.

the class ViewOrganizationSettingsServiceFacadeWebTier method getGeneralConfig.

private Properties getGeneralConfig() {
    Properties configContent = new Properties();
    MifosConfigurationManager configuration = MifosConfigurationManager.getInstance();
    String maxPointsPerPPISurvey = configuration.getString("GeneralConfig.MaxPointsPerPPISurvey");
    String batchSizeForBatchJobs = configuration.getString("GeneralConfig.BatchSizeForBatchJobs");
    String recordCommittingSizeForBatchJobs = configuration.getString("GeneralConfig.RecordCommittingSizeForBatchJobs");
    String outputIntervalForBatchJobs = configuration.getString("GeneralConfig.OutputIntervalForBatchJobs");
    String allowDataPrefetchingWhenSavingCollectionSheets = configuration.getString("GeneralConfig.allowDataPrefetchingWhenSavingCollectionSheets");
    String shutdownCountdownNotificationThreshold = configuration.getString("GeneralConfig.ShutdownCountdownNotificationThreshold");
    String imageStorageType = configuration.getString("GeneralConfig.ImageStorageType");
    String uploadStorageDirectory = getUploadStorageDirectory();
    String uploadQGDirectory = new ConfigurationLocator().resolvePath(getUploadQGDirectory());
    String imageStorageDirectory = ImageStorageManager.getStorageLocation();
    configContent.put("maxPointsPerPPISurvey", maxPointsPerPPISurvey);
    configContent.put("batchSizeForBatchJobs", batchSizeForBatchJobs);
    configContent.put("recordCommittingSizeForBatchJobs", recordCommittingSizeForBatchJobs);
    configContent.put("outputIntervalForBatchJobs", outputIntervalForBatchJobs);
    configContent.put("allowDataPrefetchingWhenSavingCollectionSheets", allowDataPrefetchingWhenSavingCollectionSheets);
    configContent.put("shutdownCountdownNotificationThreshold", shutdownCountdownNotificationThreshold);
    configContent.put("imageStorageType", imageStorageType);
    configContent.put("uploadStorageDirectory", uploadStorageDirectory);
    configContent.put("uploadQGDirectory", uploadQGDirectory);
    configContent.put("imageStorageDirectory", imageStorageDirectory);
    return configContent;
}
Also used : Properties(java.util.Properties) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager)

Example 32 with MifosConfigurationManager

use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.

the class ViewOrganizationSettingsServiceFacadeWebTier method getMiscRules.

private Properties getMiscRules(HttpSession httpSession) {
    Properties misc = new Properties();
    Integer timeoutVal = httpSession.getMaxInactiveInterval() / 60;
    misc.setProperty("sessionTimeout", timeoutVal.toString());
    misc.setProperty("backDatedTransactions", booleanToYesNo(AccountingRules.isBackDatedTxnAllowed()));
    misc.setProperty("backDatedApprovals", booleanToYesNo(AccountingRules.isBackDatedApprovalAllowed()));
    ConfigurationBusinessService cbs = new ConfigurationBusinessService();
    misc.setProperty("glim", booleanToYesNo(cbs.isGlimEnabled()));
    misc.setProperty("lsim", booleanToYesNo(cbs.isRepaymentIndepOfMeetingEnabled()));
    MifosConfigurationManager configurationManager = MifosConfigurationManager.getInstance();
    misc.setProperty("backDatedLoanProductCreationAllowed", booleanToYesNo(configurationManager.getBoolean(LoanConstants.BACK_DATED_LOAN_PRODUCT_CREATION)));
    misc.setProperty("grouploanwithmembers", booleanToYesNo(AccountingRules.isGroupLoanWithMembers()));
    return misc;
}
Also used : ConfigurationBusinessService(org.mifos.config.business.service.ConfigurationBusinessService) Properties(java.util.Properties) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager)

Example 33 with MifosConfigurationManager

use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.

the class ViewOrganizationSettingsServiceFacadeWebTier method getRest.

private Properties getRest() {
    Properties configContent = new Properties();
    MifosConfigurationManager configuration = MifosConfigurationManager.getInstance();
    String approvalRequired = configuration.getString("REST.approvalRequired");
    configContent.put("approvalRequired", approvalRequired);
    return configContent;
}
Also used : Properties(java.util.Properties) MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager)

Example 34 with MifosConfigurationManager

use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.

the class GeneralConfigTest method testGetMaxPointsPerPPISurvey.

public void testGetMaxPointsPerPPISurvey() {
    int configuredValue = GeneralConfig.getMaxPointsPerPPISurvey();
    MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
    int currentValue = 30;
    configMgr.setProperty(GeneralConfig.MaxPointsPerPPISurvey, currentValue);
    Assert.assertEquals(currentValue, GeneralConfig.getMaxPointsPerPPISurvey());
    // clear the MaxPointsPerPPISurvey property from the config file so
    // should get the default value
    configMgr.clearProperty(GeneralConfig.MaxPointsPerPPISurvey);
    int defaultValue = GeneralConfig.getMaxPointsPerPPISurvey();
    int expectedDefaultValue = 101;
    Assert.assertEquals(defaultValue, expectedDefaultValue);
    // save it back
    configMgr.setProperty(GeneralConfig.MaxPointsPerPPISurvey, configuredValue);
}
Also used : MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager)

Example 35 with MifosConfigurationManager

use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.

the class AccountingRulesTest method canConfigureAlternateCurrencyWithNonDefaultDigitsAfterDecimal.

@Test
public void canConfigureAlternateCurrencyWithNonDefaultDigitsAfterDecimal() {
    MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
    try {
        configMgr.setProperty(AccountingRulesConstants.ADDITIONAL_CURRENCY_CODES, TestUtils.EURO.getCurrencyCode());
        configMgr.setProperty(AccountingRulesConstants.DIGITS_AFTER_DECIMAL + "." + TestUtils.EURO.getCurrencyCode(), (short) 2);
        assertEquals(new Short("2"), AccountingRules.getDigitsAfterDecimal(TestUtils.EURO));
    } finally {
        configMgr.clearProperty(AccountingRulesConstants.ADDITIONAL_CURRENCY_CODES);
        configMgr.clearProperty(AccountingRulesConstants.DIGITS_AFTER_DECIMAL + "." + TestUtils.EURO.getCurrencyCode());
    }
}
Also used : MifosConfigurationManager(org.mifos.config.business.MifosConfigurationManager) Test(org.junit.Test)

Aggregations

MifosConfigurationManager (org.mifos.config.business.MifosConfigurationManager)66 Test (org.junit.Test)18 ConfigurationException (org.mifos.config.exceptions.ConfigurationException)8 Properties (java.util.Properties)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 PersistenceException (org.mifos.framework.exceptions.PersistenceException)5 ApplicationException (org.mifos.framework.exceptions.ApplicationException)4 RoundingMode (java.math.RoundingMode)3 ConfigurationPersistence (org.mifos.config.persistence.ConfigurationPersistence)3 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)3 SystemException (org.mifos.framework.exceptions.SystemException)3 BigDecimal (java.math.BigDecimal)2 Ignore (org.junit.Ignore)2 AccountBO (org.mifos.accounts.business.AccountBO)2 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)2 ConfigurationKeyValue (org.mifos.config.business.ConfigurationKeyValue)2 CurrencyMismatchException (org.mifos.core.CurrencyMismatchException)2 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1