Search in sources :

Example 6 with ConfigurationBean

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());
}
Also used : ConfigurationDao(org.akaza.openclinica.dao.hibernate.ConfigurationDao) ConfigurationBean(org.akaza.openclinica.domain.technicaladmin.ConfigurationBean)

Example 7 with ConfigurationBean

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;
}
Also used : ConfigurationBean(org.akaza.openclinica.domain.technicaladmin.ConfigurationBean) HashMap(java.util.HashMap)

Example 8 with ConfigurationBean

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);
}
Also used : ConfigurationBean(org.akaza.openclinica.domain.technicaladmin.ConfigurationBean)

Aggregations

ConfigurationBean (org.akaza.openclinica.domain.technicaladmin.ConfigurationBean)8 ConfigurationDao (org.akaza.openclinica.dao.hibernate.ConfigurationDao)3 HashMap (java.util.HashMap)2 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)1 Validator (org.akaza.openclinica.control.form.Validator)1