use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class AccountingDaoHibernate method updateLastProcessDate.
public void updateLastProcessDate(Date lastProcessDate) {
Query q = createdNamedQuery("getConfigurationKeyValueByKey");
q.setString("KEY", "MisProcessing");
List<ConfigurationKeyValue> list = q.list();
if (list.size() > 0) {
ConfigurationKeyValue configurationKeyValue = list.get(0);
configurationKeyValue.setValue(DateUtils.format(lastProcessDate));
try {
createOrUpdate(configurationKeyValue);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class MonthClosingServiceFacadeWebTier method getMonthClosingDate.
@Override
public Date getMonthClosingDate() {
ConfigurationKeyValue configurationKeyValue = configurationPersistence.getConfigurationKeyValue(MONTH_CLOSING_DAY_CONFIG_KEY);
Date monthClosingDay = null;
if (configurationKeyValue != null) {
monthClosingDay = DateUtils.getDateAsRetrievedFromDb(configurationKeyValue.getValue());
}
return monthClosingDay;
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ClientCustActionFormTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
form = new ClientCustActionForm();
errors = new ActionErrors();
ConfigurationKeyValue groupCanApplyLoansKey = new ConfigurationKeyValue(ClientRules.GroupCanApplyLoansKey, 1);
ConfigurationKeyValue clientCanExistOutsideGroupKey = new ConfigurationKeyValue(ClientRules.ClientCanExistOutsideGroupKey, 1);
ConfigurationPersistence configPersistence = mock(ConfigurationPersistence.class);
when(configPersistence.getConfigurationKeyValue(ClientRules.GroupCanApplyLoansKey)).thenReturn(groupCanApplyLoansKey);
when(configPersistence.getConfigurationKeyValue(ClientRules.ClientCanExistOutsideGroupKey)).thenReturn(clientCanExistOutsideGroupKey);
ClientRules.setConfigPersistence(configPersistence);
minimumAgeForNewClientBeforeTestRun = ClientRules.getMinimumAgeForNewClient();
maximumAgeForNewClientBeforeTestRun = ClientRules.getMaximumAgeForNewClient();
ageCheckSettingBeforeTestRun = ClientRules.isAgeCheckEnabled();
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ConfigurationPersistence method createOrUpdateConfigurationKeyValueString.
public void createOrUpdateConfigurationKeyValueString(String key, String value) throws PersistenceException {
ConfigurationKeyValue keyValue = getConfigurationKeyValue(key);
if (keyValue == null) {
keyValue = new ConfigurationKeyValue(key, value);
} else if (ConfigurationKeyValue.Type.TEXT.getTypeId().equals(keyValue.getType())) {
keyValue.setValue(value);
} else {
throw new RuntimeException("Invalid configuration type for key: " + "'" + key + "'");
}
createOrUpdate(keyValue);
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ConfigurationPersistence method getConfigurationKeyValue.
public ConfigurationKeyValue getConfigurationKeyValue(String key) {
HashMap<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put(KEY_QUERY_PARAMETER, key);
try {
return (ConfigurationKeyValue) execUniqueResultNamedQuery(NamedQueryConstants.GET_CONFIGURATION_KEYVALUE_BY_KEY, queryParameters);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations