allowed removal of existing config values
This commit is contained in:
@ -164,7 +164,7 @@ public class ConfigService implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
LOGGER.error("Account for usreName {} not found", accountName);
|
LOGGER.error("Account for userName {} not found", accountName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return updateConfigValue(configKey, account, configValue);
|
return updateConfigValue(configKey, account, configValue);
|
||||||
@ -174,8 +174,8 @@ public class ConfigService implements Serializable {
|
|||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
@TransactionAttribute(REQUIRES_NEW)
|
@TransactionAttribute(REQUIRES_NEW)
|
||||||
public boolean updateConfigValue(String configKey, Account account, String configValue) {
|
public boolean updateConfigValue(String configKey, Account account, String configValue) {
|
||||||
if ((configKey == null) || (configKey.equals("")) || (configValue == null) || (configValue.equals(""))) {
|
if ((configKey == null) || (configKey.equals(""))) {
|
||||||
// null or empty key / values are not possible
|
// null or empty key
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,10 +195,18 @@ public class ConfigService implements Serializable {
|
|||||||
} else {
|
} else {
|
||||||
if ((currentEntity.getConfigValue() != null) && (currentEntity.getConfigValue().equals(configValue))) {
|
if ((currentEntity.getConfigValue() != null) && (currentEntity.getConfigValue().equals(configValue))) {
|
||||||
// value is the same - no update
|
// value is the same - no update
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("configValue {} not changed, keeping {}", configKey, currentEntity.getConfigValue());
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
String oldValue = currentEntity.getConfigValue();
|
||||||
currentEntity.setConfigValue(configValue);
|
currentEntity.setConfigValue(configValue);
|
||||||
em.merge(currentEntity);
|
em.merge(currentEntity);
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("configValue for {} updated from {} to {}", configKey, oldValue, configValue);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user