[AB-82] adding feature mode to make it configurable whether or not the youtube video will show details or not

adding convenience method to config service
This commit is contained in:
Sheldan
2021-03-29 03:02:46 +02:00
parent 8a8e6b2347
commit 8c026d3547
7 changed files with 51 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.models.database.AConfig;
import dev.sheldan.abstracto.core.models.property.SystemConfigProperty;
import dev.sheldan.abstracto.core.service.management.ConfigManagementService;
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -73,6 +74,11 @@ public class ConfigServiceBean implements ConfigService {
return config.getLongValue();
}
@Override
public Boolean getBooleanValueOrConfigDefault(String name, Long serverId) {
return BooleanUtils.toBoolean(getStringValueOrConfigDefault(name, serverId));
}
@Override
public void setDoubleValue(String name, Long serverId, Double value) {
if(configManagementService.configExists(serverId, name)) {

View File

@@ -11,6 +11,7 @@ public interface ConfigService {
String getStringValue(String name, Long serverId, String defaultValue);
String getStringValueOrConfigDefault(String name, Long serverId);
Long getLongValue(String name, Long serverId, Long defaultValue);
Boolean getBooleanValueOrConfigDefault(String name, Long serverId);
AConfig setOrCreateConfigValue(Long serverId, String name, AConfig value);
void setDoubleValue(String name, Long serverId, Double value);
void setLongValue(String name, Long serverId, Long value);