From fe45a0357cae568ee63f96616dd7a8e1b45464c3 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 12 Jul 2021 11:27:52 +0200 Subject: [PATCH] SEBSERV-137 fixed --> "Connection requested" shall be considered as active SEB Client --- .../gbl/model/session/ClientConnection.java | 4 ++-- .../gui/content/MonitoringClientConnection.java | 2 +- .../gui/content/MonitoringRunningExam.java | 2 +- .../service/session/ClientConnectionDetails.java | 2 +- .../service/session/ClientConnectionTable.java | 2 +- .../seb/sebserver/webservice/WebserviceInit.java | 4 ++++ .../servicelayer/session/ExamSessionService.java | 16 +--------------- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java index dc1584f0..b8d54df9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientConnection.java @@ -34,12 +34,12 @@ public final class ClientConnection implements GrantEntity { public final boolean connectingStatus; public final boolean establishedStatus; - public final boolean indicatorActiveStatus; + public final boolean clientActiveStatus; ConnectionStatus(final boolean connectingStatus, final boolean establishedStatus) { this.connectingStatus = connectingStatus; this.establishedStatus = establishedStatus; - this.indicatorActiveStatus = connectingStatus || establishedStatus; + this.clientActiveStatus = connectingStatus || establishedStatus; } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java index e71d9114..d98f5f3d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java @@ -369,7 +369,7 @@ public class MonitoringClientConnection implements TemplateComposer { }) .noEventPropagation() .publishIf(() -> currentUser.get().hasRole(UserRole.EXAM_SUPPORTER) && - connectionData.clientConnection.status.indicatorActiveStatus); + connectionData.clientConnection.status.clientActiveStatus); if (connectionData.clientConnection.status == ConnectionStatus.ACTIVE) { final ProctoringServiceSettings proctoringSettings = restService diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringRunningExam.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringRunningExam.java index f2337e9a..0156dc47 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringRunningExam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringRunningExam.java @@ -436,7 +436,7 @@ public class MonitoringRunningExam implements TemplateComposer { private Set selectionForQuitInstruction(final ClientConnectionTable clientTable) { final Set connectionTokens = clientTable.getConnectionTokens( - cc -> cc.status.indicatorActiveStatus, + cc -> cc.status.clientActiveStatus, true); if (connectionTokens == null || connectionTokens.isEmpty()) { return Collections.emptySet(); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java index 0e83d160..601dffab 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java @@ -189,7 +189,7 @@ public class ClientConnectionDetails { final double value = indValue.getValue(); final String displayValue = IndicatorValue.getDisplayValue(indValue); - if (!this.connectionData.clientConnection.status.indicatorActiveStatus) { + if (!this.connectionData.clientConnection.status.clientActiveStatus) { form.setFieldValue( indData.indicator.name, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java index aa821159..db8e489a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionTable.java @@ -597,7 +597,7 @@ public final class ClientConnectionTable { continue; } - if (!this.connectionData.clientConnection.status.indicatorActiveStatus) { + if (!this.connectionData.clientConnection.status.clientActiveStatus) { final String value = (indicatorData.indicator.type.showOnlyInActiveState) ? Constants.EMPTY_NOTE : IndicatorValue.getDisplayValue(indicatorValue); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java index d87df930..6ada3aa4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java @@ -86,6 +86,10 @@ public class WebserviceInit implements ApplicationListener"); SEBServerInit.INIT_LOGGER.info("----> *** Info:"); + if (this.webserviceInfo.isDistributed()) { + SEBServerInit.INIT_LOGGER.info("----> Distributed Setup: {}", this.webserviceInfo.getWebserviceUUID()); + } + try { SEBServerInit.INIT_LOGGER.info("----> Server address: {}", this.environment.getProperty("server.address")); SEBServerInit.INIT_LOGGER.info("----> Server port: {}", this.environment.getProperty("server.port")); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/ExamSessionService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/ExamSessionService.java index dac071ad..14b362ce 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/ExamSessionService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/ExamSessionService.java @@ -14,14 +14,12 @@ import java.util.function.Predicate; import org.springframework.cache.CacheManager; -import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.APIMessage; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection.ConnectionStatus; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnectionData; import ch.ethz.seb.sebserver.gbl.util.Result; -import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientConnectionDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ExamDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; @@ -185,19 +183,7 @@ public interface ExamSessionService { * @param connection ClientConnectionData instance * @return true if the given ClientConnectionData is an active SEB client connection */ static boolean isActiveConnection(final ClientConnectionData connection) { - if (connection.clientConnection.status.establishedStatus) { - return true; - } - - if (connection.clientConnection.status == ConnectionStatus.CONNECTION_REQUESTED) { - final Long creationTime = connection.clientConnection.getCreationTime(); - final long millisecondsNow = Utils.getMillisecondsNow(); - if (millisecondsNow - creationTime < 30 * Constants.SECOND_IN_MILLIS) { - return true; - } - } - - return false; + return connection.clientConnection.status.clientActiveStatus; } }