Merge remote-tracking branch 'origin/dev-1.2' into development
Conflicts: src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java
This commit is contained in:
commit
54a0f05a39
6 changed files with 20 additions and 43 deletions
|
@ -324,7 +324,7 @@ public final class Result<T> {
|
|||
}
|
||||
}
|
||||
|
||||
public static Result<Void> tryCatch(final Runnable runnable) {
|
||||
public static Result<Void> tryCatch(final TryCatchRunnable runnable) {
|
||||
try {
|
||||
runnable.run();
|
||||
return Result.EMPTY;
|
||||
|
@ -389,4 +389,8 @@ public final class Result<T> {
|
|||
T get() throws Exception;
|
||||
}
|
||||
|
||||
public interface TryCatchRunnable {
|
||||
void run() throws Exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -587,35 +587,6 @@ public final class Utils {
|
|||
return (hexString.length() < 2) ? "0" + hexString : hexString;
|
||||
}
|
||||
|
||||
public static String toJsonObject(final Map<String, String> attributes) {
|
||||
if (attributes == null || attributes.isEmpty()) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
final StringBuilder builder = attributes
|
||||
.entrySet()
|
||||
.stream()
|
||||
.reduce(
|
||||
new StringBuilder(Constants.CURLY_BRACE_OPEN),
|
||||
(sb, entry) -> sb
|
||||
.append(Constants.DOUBLE_QUOTE)
|
||||
.append(entry.getKey())
|
||||
.append(Constants.DOUBLE_QUOTE)
|
||||
.append(Constants.COLON)
|
||||
.append(getJSONValue(entry.getValue()))
|
||||
.append(Constants.COMMA),
|
||||
StringBuilder::append)
|
||||
.append(Constants.CURLY_BRACE_CLOSE);
|
||||
|
||||
if (builder.length() > 0) {
|
||||
return builder
|
||||
.deleteCharAt(builder.length() - 1)
|
||||
.toString();
|
||||
} else {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getJSONValue(final String value) {
|
||||
if (Constants.TRUE_STRING.equalsIgnoreCase(value) || Constants.FALSE_STRING.equalsIgnoreCase(value)) {
|
||||
return value.toLowerCase();
|
||||
|
|
|
@ -262,7 +262,6 @@ public class MonitoringClientConnection implements TemplateComposer {
|
|||
|
||||
NOTIFICATION_LIST_NO_SELECTION_KEY)
|
||||
.noEventPropagation()
|
||||
|
||||
.publishIf(() -> currentUser.get().hasRole(UserRole.EXAM_SUPPORTER), false);
|
||||
|
||||
_notificationTableSupplier = () -> notificationTable;
|
||||
|
@ -396,15 +395,6 @@ public class MonitoringClientConnection implements TemplateComposer {
|
|||
.publish();
|
||||
}
|
||||
|
||||
// actionBuilder
|
||||
// .newAction(ActionDefinition.MONITOR_EXAM_CLIENT_CONNECTION_EXAM_ROOM_PROCTORING)
|
||||
// .withEntityKey(parentEntityKey)
|
||||
// .withExec(action -> this.monitoringProctoringService.openExamCollectionProctorScreen(
|
||||
// action,
|
||||
// connectionData))
|
||||
// .noEventPropagation()
|
||||
// .publish();
|
||||
|
||||
clientConnectionDetails.setStatusChangeListener(ccd -> {
|
||||
this.pageService.firePageEvent(
|
||||
new ActionActivationEvent(
|
||||
|
@ -426,6 +416,11 @@ public class MonitoringClientConnection implements TemplateComposer {
|
|||
final EntityKey entityKey = table.getSingleSelection();
|
||||
final EntityKey parentEntityKey = pageAction.getParentEntityKey();
|
||||
|
||||
if (entityKey == null) {
|
||||
pageAction.pageContext().publishInfo(NOTIFICATION_LIST_NO_SELECTION_KEY);
|
||||
return pageAction;
|
||||
}
|
||||
|
||||
this.pageService.getRestService()
|
||||
.getBuilder(ConfirmPendingClientNotification.class)
|
||||
.withURIVariable(API.PARAM_PARENT_MODEL_ID, parentEntityKey.modelId)
|
||||
|
|
|
@ -143,7 +143,14 @@ public abstract class AbstractCourseAccess {
|
|||
|
||||
public Result<ExamineeAccountDetails> getExamineeAccountDetails(final String examineeSessionId) {
|
||||
final Supplier<ExamineeAccountDetails> accountDetailsSupplier = accountDetailsSupplier(examineeSessionId);
|
||||
return this.accountDetailRequest.protectedRun(accountDetailsSupplier);
|
||||
return this.accountDetailRequest.protectedRun(() -> {
|
||||
try {
|
||||
return accountDetailsSupplier.get();
|
||||
} catch (final Exception e) {
|
||||
log.error("Unexpected error while trying to get examinee account details: ", e);
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Default implementation that uses getExamineeAccountDetails to geht the examinee name
|
||||
|
|
|
@ -34,7 +34,6 @@ import ch.ethz.seb.sebserver.gbl.model.session.ClientInstruction.InstructionType
|
|||
import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||
import ch.ethz.seb.sebserver.gbl.util.SizedArrayNonBlockingQueue;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||
import ch.ethz.seb.sebserver.webservice.WebserviceInfo;
|
||||
import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.ClientInstructionRecord;
|
||||
import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ClientConnectionDAO;
|
||||
|
@ -143,7 +142,7 @@ public class SEBClientInstructionServiceImpl implements SEBClientInstructionServ
|
|||
|
||||
return Result.tryCatch(() -> {
|
||||
|
||||
final String attributesString = Utils.toJsonObject(attributes);
|
||||
final String attributesString = this.jsonMapper.writeValueAsString(attributes);
|
||||
final Set<String> activeConnections = this.clientConnectionDAO
|
||||
.filterForInstructionStatus(examId, connectionTokens)
|
||||
.getOrElse(Collections::emptySet);
|
||||
|
|
|
@ -35,6 +35,7 @@ logging.level.ch=INFO
|
|||
# logging.file=/sebserver/log/sebserver.log
|
||||
|
||||
### spring actuator configuration
|
||||
management.endpoints.jmx.exposure.include=metrics,logfile,loggers,heapdump,health
|
||||
management.endpoints.web.base-path=/mprofile
|
||||
management.endpoints.web.exposure.include=metrics,logfile,loggers,heapdump,health
|
||||
|
||||
|
|
Loading…
Reference in a new issue