@Override
@DB
public String getValueAndInitIfNotExist(String name, String category, String initValue) {
String returnValue = initValue;
try {
ConfigurationVO config = findByName(name);
if (config != null) {
if (config.getValue() != null) {
returnValue = config.getValue();
} else {
update(name, category, initValue);
}
} else {
if (category.equals("Hidden") || category.equals("Secure")) {
initValue = DBEncryptionUtil.encrypt(initValue);
}
ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, "");
persist(newConfig);
}
return returnValue;
} catch (Exception e) {
s_logger.warn("Unable to update Configuration Value", e);