use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class StandardTestingService method setAccountingRules.
@Override
public void setAccountingRules(String accountingRulesParamName, String accountingRulesParamValue) throws MifosException {
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (accountingRulesParamValue == null || accountingRulesParamValue.equals("")) {
configMgr.clearProperty(accountingRulesParamName);
return;
}
configMgr.setProperty(accountingRulesParamName, accountingRulesParamValue);
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class StandardTestingService method setLocale.
@Override
public void setLocale(String languageCode, String countryCode) throws MifosException {
try {
LocaleSetting configLocale = new LocaleSetting();
configLocale.setLanguageCode(languageCode);
configLocale.setCountryCode(countryCode);
Localization localization = Localization.getInstance();
localization.setConfigLocale(configLocale);
if (SecurityContextHolder.getContext() != null) {
if (SecurityContextHolder.getContext().getAuthentication() != null) {
if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() != null) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
user.setPreferredLocaleId(Localization.getInstance().getLocaleId(Localization.getInstance().getConfiguredLocale()));
}
}
}
StaticHibernateUtil.startTransaction();
PersonnelBO p = (PersonnelBO) StaticHibernateUtil.getSessionTL().get(PersonnelBO.class, (short) 1);
p.setPreferredLocale(Localization.getInstance().getConfiguredLocaleId());
StaticHibernateUtil.getSessionTL().update(p);
StaticHibernateUtil.commitTransaction();
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
configMgr.setProperty("Localization.LanguageCode", languageCode);
configMgr.setProperty("Localization.CountryCode", countryCode);
} catch (MifosRuntimeException e) {
throw new MifosException("The locale " + languageCode + "_" + countryCode + " is not supported by Mifos.");
}
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientFamilyInfoConfig method getMaximumNumberOfFamilyMembers.
public static int getMaximumNumberOfFamilyMembers() throws ConfigurationException {
//default value is 15
int familyMembers = 15;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(MaximumNumberOfFamilyMembers)) {
familyMembers = configMgr.getInt(MaximumNumberOfFamilyMembers);
} else {
throw new ConfigurationException("The Maximum Number of Family Members are not defined in " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME);
}
return familyMembers;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientFamilyInfoConfig method getAreFamilyDetailsRequired.
public static Boolean getAreFamilyDetailsRequired() throws ConfigurationException {
//default value is false
Boolean required = false;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(AreFamilyDetailsRequired)) {
required = configMgr.getBoolean(AreFamilyDetailsRequired);
} else {
throw new ConfigurationException("The property are family details required is not set in " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME);
}
return required;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientRules method getMaximumAge.
/*
* Gets the minimum age specified in the application configuration file,
* Also Checks if its in the range of 0 to 150
*/
public static int getMaximumAge() throws ConfigurationException {
int maximumAge = 0;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(ClientRules.MaximumAgeForNewClients)) {
maximumAge = Integer.parseInt(configMgr.getString(ClientRules.MaximumAgeForNewClients));
} else {
throw new ConfigurationException("The Maximum Age for a client is not defined in " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME);
}
if (maximumAge > 150 || maximumAge < 0) {
throw new ConfigurationException("The Maximum Age defined in the " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME + "is not within the acceptable range (0 to 150)");
}
return maximumAge;
}
Aggregations