SEBSERV-89 implemented
This commit is contained in:
parent
edb751de87
commit
cf948d5827
8 changed files with 57 additions and 18 deletions
|
@ -117,7 +117,10 @@ public abstract class AbstractInputField<T extends Control> implements InputFiel
|
|||
initValue(v.value, v.listIndex);
|
||||
return v;
|
||||
})
|
||||
.orElse(null);
|
||||
.orElseGet(() -> {
|
||||
initValue(this.attribute.defaultValue, 0);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Collection;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
@ -33,7 +34,6 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationTableValues.TableV
|
|||
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue;
|
||||
import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ConfigurationAttributeRecordDynamicSqlSupport;
|
||||
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ConfigurationAttributeRecordMapper;
|
||||
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ConfigurationRecordMapper;
|
||||
|
@ -189,20 +189,19 @@ public class ConfigurationValueDAOImpl implements ConfigurationValueDAO {
|
|||
|
||||
final Long id;
|
||||
if (data.id == null) {
|
||||
id = this.configurationValueRecordMapper.selectIdsByExample()
|
||||
.where(
|
||||
ConfigurationValueRecordDynamicSqlSupport.configurationId,
|
||||
isEqualTo(data.configurationId))
|
||||
.and(
|
||||
ConfigurationValueRecordDynamicSqlSupport.configurationAttributeId,
|
||||
isEqualTo(data.attributeId))
|
||||
.and(
|
||||
ConfigurationValueRecordDynamicSqlSupport.listIndex,
|
||||
isEqualTo(data.listIndex))
|
||||
.build()
|
||||
.execute()
|
||||
.stream()
|
||||
.collect(Utils.toSingleton());
|
||||
|
||||
id = getByProperties(data)
|
||||
.orElseGet(() -> {
|
||||
log.warn("Missing SEB exam configuration attrribute value for: {}", data);
|
||||
log.info("Use self-healing strategy to recover from missing SEB exam configuration "
|
||||
+ "attrribute value\n**** Create new AttributeValue for: {}",
|
||||
data);
|
||||
|
||||
createNew(data);
|
||||
return getByProperties(data)
|
||||
.orElseThrow();
|
||||
|
||||
});
|
||||
} else {
|
||||
id = data.id;
|
||||
}
|
||||
|
@ -446,4 +445,21 @@ public class ConfigurationValueDAOImpl implements ConfigurationValueDAO {
|
|||
return data;
|
||||
}
|
||||
|
||||
private Optional<Long> getByProperties(final ConfigurationValue data) {
|
||||
return this.configurationValueRecordMapper.selectIdsByExample()
|
||||
.where(
|
||||
ConfigurationValueRecordDynamicSqlSupport.configurationId,
|
||||
isEqualTo(data.configurationId))
|
||||
.and(
|
||||
ConfigurationValueRecordDynamicSqlSupport.configurationAttributeId,
|
||||
isEqualTo(data.attributeId))
|
||||
.and(
|
||||
ConfigurationValueRecordDynamicSqlSupport.listIndex,
|
||||
isEqualTo(data.listIndex))
|
||||
.build()
|
||||
.execute()
|
||||
.stream()
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,9 @@ public class IntegerConverter implements AttributeValueConverter {
|
|||
final ConfigurationValue value,
|
||||
final String template) throws IOException {
|
||||
|
||||
final String val = (value.value != null) ? value.value : attribute.getDefaultValue();
|
||||
final String val = (value != null && value.value != null)
|
||||
? value.value
|
||||
: attribute.getDefaultValue();
|
||||
int intVal = 0;
|
||||
|
||||
try {
|
||||
|
|
|
@ -225,6 +225,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
|
|||
(314, 'allowDisplayMirroring', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(315, 'allowedDisplaysMaxNumber', 'COMBO_SELECTION', null, '1,2,3', null, null, '1'),
|
||||
(316, 'allowedDisplayBuiltin', 'CHECKBOX', null, null, null, null, 'true'),
|
||||
(317, 'logLevel', 'SINGLE_SELECTION', null, '0,1,2,3,4', null, null, '1'),
|
||||
|
||||
(400, 'insideSebEnableSwitchUser', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(401, 'insideSebEnableLockThisComputer', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
|
@ -439,6 +440,7 @@ INSERT IGNORE INTO orientation VALUES
|
|||
(314, 314, 0, 9, 'macSettings', 7, 7, 5, 1, 'NONE'),
|
||||
(315, 315, 0, 9, 'macSettings', 7, 9, 5, 1, 'TOP'),
|
||||
(316, 316, 0, 9, 'macSettings', 7, 10, 5, 1, 'NONE'),
|
||||
(317, 317, 0, 9, 'logging', 3, 11, 4, 1, 'LEFT_SPAN'),
|
||||
|
||||
(400, 400, 0, 10, 'registry', 0, 1, 4, 1, 'NONE'),
|
||||
(401, 401, 0, 10, 'registry', 0, 2, 4, 1, 'NONE'),
|
||||
|
|
|
@ -199,6 +199,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
|
|||
(314, 'allowDisplayMirroring', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(315, 'allowedDisplaysMaxNumber', 'COMBO_SELECTION', null, '1,2,3', null, null, '1'),
|
||||
(316, 'allowedDisplayBuiltin', 'CHECKBOX', null, null, null, null, 'true'),
|
||||
(317, 'logLevel', 'SINGLE_SELECTION', null, '0,1,2,3,4', null, null, '1'),
|
||||
|
||||
(400, 'insideSebEnableSwitchUser', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(401, 'insideSebEnableLockThisComputer', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
|
@ -413,6 +414,7 @@ INSERT IGNORE INTO orientation VALUES
|
|||
(314, 314, 0, 9, 'macSettings', 7, 7, 5, 1, 'NONE'),
|
||||
(315, 315, 0, 9, 'macSettings', 7, 9, 5, 1, 'TOP'),
|
||||
(316, 316, 0, 9, 'macSettings', 7, 10, 5, 1, 'NONE'),
|
||||
(317, 317, 0, 9, 'logging', 3, 11, 4, 1, 'LEFT_SPAN'),
|
||||
|
||||
(400, 400, 0, 10, 'registry', 0, 1, 4, 1, 'NONE'),
|
||||
(401, 401, 0, 10, 'registry', 0, 2, 4, 1, 'NONE'),
|
||||
|
|
|
@ -840,6 +840,18 @@ sebserver.examconfig.props.label.allowedDisplaysMaxNumber=Maximum allowed number
|
|||
sebserver.examconfig.props.label.allowedDisplaysMaxNumber.tooltip=If more displays are connected, this are blanked with an orange full screen window
|
||||
sebserver.examconfig.props.label.allowedDisplayBuiltin=Use built-in display
|
||||
sebserver.examconfig.props.label.allowedDisplayBuiltin.tooltip=Use the built-in display (if available) when only one display is allowed or when switching off display mirroring
|
||||
sebserver.examconfig.props.label.logLevel=Log Level
|
||||
sebserver.examconfig.props.label.logLevel.tooltip=The log will contain the selected log level plus all levels with a lower value
|
||||
sebserver.examconfig.props.label.logLevel.0=Error
|
||||
sebserver.examconfig.props.label.logLevel.0.tooltip=Error includes fatal application and browser level errors
|
||||
sebserver.examconfig.props.label.logLevel.1=Warning
|
||||
sebserver.examconfig.props.label.logLevel.1.tooltip=Warning are non-fatal but non-expected or security affecting events
|
||||
sebserver.examconfig.props.label.logLevel.2=Info
|
||||
sebserver.examconfig.props.label.logLevel.2.tooltip=Info includes most user actions including all browser navigation actions
|
||||
sebserver.examconfig.props.label.logLevel.3=Debug
|
||||
sebserver.examconfig.props.label.logLevel.3.tooltip=Debug is reserved for information which is only necessary for in-deep program code debugging
|
||||
sebserver.examconfig.props.label.logLevel.4=Verbose
|
||||
sebserver.examconfig.props.label.logLevel.4.tooltip=Verbose level contains events of all levels
|
||||
|
||||
sebserver.examconfig.props.group.registry=While running SEB
|
||||
sebserver.examconfig.props.group.registry.tooltip=Options in the Windows Security Screen invoked by Ctrl-Alt-Del
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -206,6 +206,7 @@ INSERT IGNORE INTO configuration_attribute VALUES
|
|||
(314, 'allowDisplayMirroring', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(315, 'allowedDisplaysMaxNumber', 'COMBO_SELECTION', null, '1,2,3', null, null, '1'),
|
||||
(316, 'allowedDisplayBuiltin', 'CHECKBOX', null, null, null, null, 'true'),
|
||||
(317, 'logLevel', 'SINGLE_SELECTION', null, '0,1,2,3,4', null, null, '1'),
|
||||
|
||||
(400, 'insideSebEnableSwitchUser', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
(401, 'insideSebEnableLockThisComputer', 'CHECKBOX', null, null, null, null, 'false'),
|
||||
|
@ -420,6 +421,7 @@ INSERT IGNORE INTO orientation VALUES
|
|||
(314, 314, 0, 9, 'macSettings', 7, 7, 5, 1, 'NONE'),
|
||||
(315, 315, 0, 9, 'macSettings', 7, 9, 5, 1, 'TOP'),
|
||||
(316, 316, 0, 9, 'macSettings', 7, 10, 5, 1, 'NONE'),
|
||||
(317, 317, 0, 9, 'logging', 3, 11, 4, 1, 'LEFT_SPAN'),
|
||||
|
||||
(400, 400, 0, 10, 'registry', 0, 1, 4, 1, 'NONE'),
|
||||
(401, 401, 0, 10, 'registry', 0, 2, 4, 1, 'NONE'),
|
||||
|
|
Loading…
Add table
Reference in a new issue