use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ConfigurationPersistence method updateConfigurationKeyValueInteger.
/**
* Update the value of a persistent integer configuration value;
*/
public void updateConfigurationKeyValueInteger(String key, int value) throws PersistenceException {
ConfigurationKeyValue keyValue = getConfigurationKeyValue(key);
if (keyValue != null && ConfigurationKeyValue.Type.INTEGER.getTypeId().equals(keyValue.getType())) {
keyValue.setValue(Integer.toString(value));
createOrUpdate(keyValue);
} else {
throw new RuntimeException("Configuration parameter not found for key: " + "'" + key + "'");
}
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ConfigurationPersistence method getConfigurationKeyValueWithoutFlush.
public ConfigurationKeyValue getConfigurationKeyValueWithoutFlush(String key) {
HashMap<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put(KEY_QUERY_PARAMETER, key);
try {
return (ConfigurationKeyValue) execUniqueResultNamedQueryWithoutFlush(NamedQueryConstants.GET_CONFIGURATION_KEYVALUE_BY_KEY, queryParameters);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class ConfigurationPersistence method addConfigurationKeyValueInteger.
/**
* Create a new persistent integer configuration key value pair.
*/
public void addConfigurationKeyValueInteger(String key, int value) throws PersistenceException {
ConfigurationKeyValue keyValue = new ConfigurationKeyValue(key, value);
createOrUpdate(keyValue);
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class AccountingDaoHibernate method findLastProcessingUpdatedDate.
@Override
public String findLastProcessingUpdatedDate(String namedQueryString, String globalOfficeNumber) {
String lastProcessingDate = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
Query query = createdNamedQuery(namedQueryString);
query.setString("GLOBAL_OFFICE_NUMBER", globalOfficeNumber);
List<ProcessUpdateBo> list = query.list();
if (list.size() == 0) {
Query q = createdNamedQuery("getConfigurationKeyValueByKey");
q.setString("KEY", "MisProcessing");
List<ConfigurationKeyValue> value = q.list();
if (value.size() > 0) {
ConfigurationKeyValue configurationKeyValue = value.get(0);
lastProcessingDate = configurationKeyValue.getValue();
}
} else if (list.size() > 0 && !"".equals(list.get(0).getLastUpdateDate())) {
ProcessUpdateBo processUpdateBo = list.get(0);
if (processUpdateBo.getLastUpdateDate() != null) {
lastProcessingDate = simpleDateFormat.format(processUpdateBo.getLastUpdateDate());
}
}
return lastProcessingDate;
}
use of org.mifos.config.business.ConfigurationKeyValue in project head by mifos.
the class AccountingDaoHibernate method findLastProcessingDate.
@Override
public String findLastProcessingDate(String namedQueryString) {
String lastProcessingDate = null;
Query query = createdNamedQuery(namedQueryString);
query.setString("KEY", "MisProcessing");
List<ConfigurationKeyValue> list = query.list();
if (list.size() > 0 && !"".equals(list.get(0).getValue())) {
ConfigurationKeyValue configurationKeyValue = list.get(0);
lastProcessingDate = configurationKeyValue.getValue();
}
return lastProcessingDate;
}
Aggregations