mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
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:
+2
-4
@@ -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);
|
||||
}
|
||||
|
||||
+14
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user