use of org.akaza.openclinica.domain.technicaladmin.ConfigurationBean in project OpenClinica by OpenClinica.
the class ConfigurationDaoTest method testfindByKey.
public void testfindByKey() {
ConfigurationDao configurationDao = (ConfigurationDao) getContext().getBean("configurationDao");
ConfigurationBean configurationBean = configurationDao.findByKey("test.test");
assertEquals("Key should be test.test", "test.test", configurationBean.getKey());
}
use of org.akaza.openclinica.domain.technicaladmin.ConfigurationBean in project OpenClinica by OpenClinica.
the class PasswordRequirementsDao method configs.
public Map<String, Object> configs() {
HashMap<String, Object> map = new HashMap<String, Object>();
List<ConfigurationBean> beans = this.configurationDao.findAll();
for (ConfigurationBean bean : beans) {
String key = bean.getKey(), value = bean.getValue();
if (boolConfigKeys.contains(key)) {
map.put(key, Boolean.valueOf(value));
} else if (intConfigKeys.contains(key)) {
try {
map.put(key, Integer.valueOf(value));
} catch (NumberFormatException ex) {
logger.warn("Invalid configuration key: " + key + "." + " Should be an integer, but is: " + value, ex);
}
}
}
return map;
}
use of org.akaza.openclinica.domain.technicaladmin.ConfigurationBean in project OpenClinica by OpenClinica.
the class PasswordRequirementsDao method setValue.
private void setValue(String key, boolean value) {
ConfigurationBean bean = this.configurationDao.findByKey(key);
bean.setValue(Boolean.toString(value));
this.configurationDao.saveOrUpdate(bean);
}
Aggregations