SEBSERV-488

This commit is contained in:
anhefti 2023-11-29 16:34:22 +01:00
parent 9bda8630f6
commit e426a7a6e2
6 changed files with 22 additions and 20 deletions

View file

@ -18,6 +18,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Function;
import ch.ethz.seb.sebserver.gbl.FeatureService;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.swt.SWT;
@ -109,6 +110,7 @@ public class MonitoringRunningExam implements TemplateComposer {
private final MonitoringExamSearchPopup monitoringExamSearchPopup;
private final SEBSendLockPopup sebSendLockPopup;
private final MonitoringProctoringService monitoringProctoringService;
private final FeatureService featureService;
private final boolean distributedSetup;
private final long pollInterval;
@ -121,6 +123,7 @@ public class MonitoringRunningExam implements TemplateComposer {
final SEBSendLockPopup sebSendLockPopup,
final MonitoringProctoringService monitoringProctoringService,
final GuiServiceInfo guiServiceInfo,
final FeatureService featureService,
@Value("${sebserver.gui.webservice.poll-interval:2000}") final long pollInterval) {
this.serverPushService = serverPushService;
@ -134,6 +137,7 @@ public class MonitoringRunningExam implements TemplateComposer {
this.distributedSetup = guiServiceInfo.isDistributedSetup();
this.monitoringExamSearchPopup = monitoringExamSearchPopup;
this.sebSendLockPopup = sebSendLockPopup;
this.featureService = featureService;
}
@Override
@ -315,7 +319,9 @@ public class MonitoringRunningExam implements TemplateComposer {
final PageActionBuilder actionBuilder = this.pageService
.pageActionBuilder(pageContext.clearEntityKeys());
final boolean proctoringEnabled = proctoringSettings != null &&
final boolean spsFeatureEnabled = this.featureService.isEnabled(FeatureService.SCREEN_PROCTORING_FEATURE_NAME);
final boolean proctoringEnabled = spsFeatureEnabled &&
proctoringSettings != null &&
BooleanUtils.toBoolean(proctoringSettings.enableProctoring);
final boolean screenProctoringEnabled = screenProctoringSettings != null &&
BooleanUtils.toBoolean(screenProctoringSettings.enableScreenProctoring);

View file

@ -19,6 +19,7 @@ import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.*;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@ -45,11 +46,6 @@ import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ClientNotificatio
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ClientNotificationRecordMapper;
import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.ClientEventRecord;
import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.ClientNotificationRecord;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientEventDAO;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.DAOLoggingSupport;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ResourceNotFoundException;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.TransactionHandler;
@Lazy
@Component
@ -255,8 +251,9 @@ public class ClientEventDAOImpl implements ClientEventDAO {
records);
}
if (records.isEmpty() || records.size() > 1) {
throw new IllegalStateException(
if (records.size() != 1) {
throw new NoResourceFoundException(
EntityType.CLIENT_NOTIFICATION,
"Failed to find pending notification event for confirm:" + notificationValueId);
}

View file

@ -243,12 +243,7 @@ public class ExamSessionServiceImpl implements ExamSessionService {
flushCache(exam);
}
if (log.isDebugEnabled()) {
log.info("Exam {} is not currently running", examId);
}
throw new NoSuchElementException(
"No currently running exam found for id: " + examId);
throw new NoSuchElementException("No currently running exam found for id: " + examId);
}
});
}

View file

@ -214,7 +214,7 @@ public class SEBClientInstructionServiceImpl implements SEBClientInstructionServ
.append(Constants.CURLY_BRACE_CLOSE)
.toString();
if (log.isDebugEnabled()) {
if (log.isTraceEnabled()) {
log.debug("Send SEB client instruction: {} to: {} ", instructionJSON, connectionToken);
}
@ -358,7 +358,7 @@ public class SEBClientInstructionServiceImpl implements SEBClientInstructionServ
return instruction;
}
if (log.isDebugEnabled()) {
if (log.isTraceEnabled()) {
log.debug("Put SEB instruction into instruction queue: {}", instruction);
}

View file

@ -15,6 +15,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.NoResourceFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
@ -95,6 +96,13 @@ public class SEBClientNotificationServiceImpl implements SEBClientNotificationSe
.map(this::removeFromCache)
.getOrThrow();
} catch (final NoResourceFoundException e) {
if (log.isDebugEnabled()) {
log.debug(
"Notification already confirmed or removed. connectionId: {}, confirmId: {}",
event.connectionId,
event.getValue());
}
} catch (final Exception e) {
log.error(
"Failed to confirm pending notification from SEB Client side. event: {}", event, e);

View file

@ -213,10 +213,6 @@ public class ScreenProctoringServiceImpl implements ScreenProctoringService {
return this.examDAO.byPK(examId)
.map(exam -> {
if (log.isDebugEnabled()) {
log.debug("Update changed exam attributes for screen proctoring: {}", exam);
}
final String enabled = exam.additionalAttributes
.get(ScreenProctoringSettings.ATTR_ENABLE_SCREEN_PROCTORING);