use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientRules method getGroupCanApplyLoansFromConfig.
private static boolean getGroupCanApplyLoansFromConfig() {
boolean cfgValue;
try {
int dbValue = getConfigPersistence().getConfigurationValueInteger(GroupCanApplyLoansKey);
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
cfgValue = configMgr.getBoolean(ClientRulesGroupCanApplyLoans);
if (dbValue == Constants.NO && cfgValue == true) {
getConfigPersistence().updateConfigurationKeyValueInteger(GroupCanApplyLoansKey, Constants.YES);
} else if (dbValue == Constants.YES && cfgValue == false) {
if (ApplicationContextProvider.getBean(LegacyLoanDao.class).countOfGroupLoanAccounts() > 0) {
// in the config file violates business rules.
throw new MifosRuntimeException(getBadOverrideMsg(GroupCanApplyLoansKey, "Group loans may already exist."));
}
makeDatabaseConfigMatchFilebasedConfig();
}
} catch (PersistenceException ex) {
throw new MifosRuntimeException(ex);
}
return cfgValue;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientRules method getClientCanExistOutsideGroupFromConfig.
private static boolean getClientCanExistOutsideGroupFromConfig() {
boolean cfgValue;
try {
int dbValue = getConfigPersistence().getConfigurationValueInteger(ClientCanExistOutsideGroupKey);
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
cfgValue = configMgr.getBoolean(ClientRulesClientCanExistOutsideGroup);
if (dbValue == Constants.NO && cfgValue == true) {
getConfigPersistence().updateConfigurationKeyValueInteger(ClientCanExistOutsideGroupKey, Constants.YES);
} else if (dbValue == Constants.YES && cfgValue == false) {
// in the config file violates business rules.
throw new MifosRuntimeException(getBadOverrideMsg(ClientCanExistOutsideGroupKey, "Clients outside of groups may already exist."));
}
} catch (PersistenceException ex) {
throw new MifosRuntimeException(ex);
}
return cfgValue;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ClientRules method getNameSequence.
/*
* Fetches and populates ClientRules#nameSequence.
*/
public static String[] getNameSequence() {
if (nameSequence == null) {
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
nameSequence = configMgr.getStringArray(ClientRulesNameSequence);
}
return nameSequence;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class FiscalCalendarRules method getScheduleMeetingIfNonWorkingDay.
public String getScheduleMeetingIfNonWorkingDay() {
String scheduleType = null;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(FiscalCalendarRulesScheduleTypeForMeetingIfNonWorkingDay)) {
scheduleType = configMgr.getString(FiscalCalendarRulesScheduleTypeForMeetingIfNonWorkingDay);
} else {
throw new RuntimeException("The schedule type for meeting if non working day is not defined in the config file.");
}
return scheduleType;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class AccountingRules method getRoundingMode.
public static Short getRoundingMode(Short defaultValue) {
Short mode;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(AccountingRulesConstants.ROUNDING_RULE)) {
String returnStr = configMgr.getString(AccountingRulesConstants.ROUNDING_RULE);
if (returnStr.equals("FLOOR")) {
mode = MifosCurrency.FLOOR_MODE;
} else if (returnStr.equals("CEILING")) {
mode = MifosCurrency.CEILING_MODE;
} else if (returnStr.equals("HALF_UP")) {
mode = MifosCurrency.HALF_UP_MODE;
} else {
throw new RuntimeException("The rounding mode defined in the config file is not CEILING, FLOOR, HALF_UP. It is " + returnStr);
}
} else {
mode = defaultValue;
}
return mode;
}
Aggregations