bug5774: mainly fixed the implementation so that no exception occurs any more when using the new secured settings.

- Added a new documentation page under HowTo -> Development -> Secured Settings
- Cleaned up some RaceMapSetting initializations by using the newly introduced builder
- Added a PaywallResolverProxy
- Used the PaywallResolverProxy and SecuredDTOProxy to make it possible to add the underlying objects to a later time
- Refactored some field naming, especially the name of setting fields
- Changed the getValue() method of a setting to return the default value if value is null (background was the casting of NULL values to atomar return parameters like boolean or int, also a default value was set)
- Added a setValue method without permission check to be used for reset to default method, which will not be overwritten by other implementations of the AbstractValueSetting, which causes some exceptions before.
- Added log messages if a value of an secured value setting is used without paywall resolver or secured DTO
This commit is contained in:
Udo Wessels
2024-03-04 17:40:59 +01:00
parent d2063c9874
commit d1bc46ad26
27 changed files with 403 additions and 260 deletions
@@ -140,13 +140,11 @@ public abstract class AbstractGenericSerializableSettings extends AbstractSettin
*
*/
protected abstract void addChildSettings();
// TODO make protected
public Value getValue(String settingName) {
return value.getValue(settingName);
}
// TODO make protected
public void setValue(String settingName, Value value) {
this.value.setValue(settingName, value);
}
@@ -16,18 +16,26 @@ public abstract class AbstractValueSetting<T> extends AbstractHasValueSetting<T>
resetToDefault();
}
}
@Override
public T getValue() {
T result = null;
Value value = settings.getValue(settingName);
if (value == null) {
return null;
if (value != null) {
result = getValueConverter().fromValue(value);
}
return getValueConverter().fromValue(value);
if (result == null) {
result = defaultValue;
}
return result;
}
@Override
public void setValue(T value) {
setValueWithoutPermittionCheck(value);
}
private void setValueWithoutPermittionCheck(T value) {
settings.setValue(settingName, getValueConverter().toValue(value));
}
@@ -46,7 +54,8 @@ public abstract class AbstractValueSetting<T> extends AbstractHasValueSetting<T>
@Override
public void resetToDefault() {
this.setValue(defaultValue);
//setValue(defaultValue);
setValueWithoutPermittionCheck(defaultValue);
}
@Override