Merge remote-tracking branch 'origin/dev-1.2' into development
Conflicts: src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientConnectionServiceImpl.java src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java
This commit is contained in:
commit
6fc54e5310
7 changed files with 57 additions and 12 deletions
|
@ -26,16 +26,20 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API;
|
import ch.ethz.seb.sebserver.gbl.api.API;
|
||||||
import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
import ch.ethz.seb.sebserver.gbl.api.API.BulkActionType;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.api.APIMessage.ErrorMessage;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityDependency;
|
import ch.ethz.seb.sebserver.gbl.model.EntityDependency;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
import ch.ethz.seb.sebserver.gbl.model.EntityKey;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
import ch.ethz.seb.sebserver.gbl.model.EntityProcessingReport;
|
||||||
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
|
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||||
import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition;
|
import ch.ethz.seb.sebserver.gui.content.action.ActionDefinition;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
|
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.page.PageMessageException;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.event.ActionEvent;
|
import ch.ethz.seb.sebserver.gui.service.page.event.ActionEvent;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard;
|
||||||
|
@ -43,6 +47,7 @@ import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardAction
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardPage;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.ModalInputWizard.WizardPage;
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCallError;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.DeleteExam;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.DeleteExam;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExam;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExam;
|
||||||
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamDependencies;
|
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExamDependencies;
|
||||||
|
@ -76,6 +81,8 @@ public class ExamDeletePopup {
|
||||||
|
|
||||||
private final static LocTextKey DELETE_CONFIRM_TITLE =
|
private final static LocTextKey DELETE_CONFIRM_TITLE =
|
||||||
new LocTextKey("sebserver.exam.delete.confirm.title");
|
new LocTextKey("sebserver.exam.delete.confirm.title");
|
||||||
|
private final static LocTextKey DELETE_ERROR_CONSISTENCY =
|
||||||
|
new LocTextKey("sebserver.exam.action.delete.consistency.error");
|
||||||
|
|
||||||
private final PageService pageService;
|
private final PageService pageService;
|
||||||
|
|
||||||
|
@ -126,7 +133,23 @@ public class ExamDeletePopup {
|
||||||
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
|
.withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId)
|
||||||
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.HARD_DELETE.name());
|
.withQueryParam(API.PARAM_BULK_ACTION_TYPE, BulkActionType.HARD_DELETE.name());
|
||||||
|
|
||||||
final EntityProcessingReport report = restCallBuilder.call().getOrThrow();
|
final Result<EntityProcessingReport> deleteCall = restCallBuilder.call();
|
||||||
|
if (deleteCall.hasError()) {
|
||||||
|
final Exception error = deleteCall.getError();
|
||||||
|
if (error instanceof RestCallError) {
|
||||||
|
final APIMessage message = ((RestCallError) error)
|
||||||
|
.getAPIMessages()
|
||||||
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (message != null && ErrorMessage.INTEGRITY_VALIDATION.isOf(message)) {
|
||||||
|
pageContext.publishPageMessage(new PageMessageException(DELETE_ERROR_CONSISTENCY));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final EntityProcessingReport report = deleteCall.getOrThrow();
|
||||||
|
|
||||||
final PageAction action = this.pageService.pageActionBuilder(pageContext)
|
final PageAction action = this.pageService.pageActionBuilder(pageContext)
|
||||||
.newAction(ActionDefinition.EXAM_VIEW_LIST)
|
.newAction(ActionDefinition.EXAM_VIEW_LIST)
|
||||||
|
|
|
@ -293,9 +293,14 @@ public final class ClientConnectionTable {
|
||||||
final Set<EntityKey> result = new HashSet<>();
|
final Set<EntityKey> result = new HashSet<>();
|
||||||
for (int i = 0; i < selectionIndices.length; i++) {
|
for (int i = 0; i < selectionIndices.length; i++) {
|
||||||
final UpdatableTableItem updatableTableItem =
|
final UpdatableTableItem updatableTableItem =
|
||||||
new ArrayList<>(this.tableMapping.values()).get(selectionIndices[0]);
|
new ArrayList<>(this.tableMapping.values())
|
||||||
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if (updatableTableItem != null) {
|
||||||
result.add(new EntityKey(updatableTableItem.connectionId, EntityType.CLIENT_CONNECTION));
|
result.add(new EntityKey(updatableTableItem.connectionId, EntityType.CLIENT_CONNECTION));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,8 @@ public class BulkActionServiceImpl implements BulkActionService {
|
||||||
final Exception error = bulkActionSingleResult.getError();
|
final Exception error = bulkActionSingleResult.getError();
|
||||||
|
|
||||||
log.error(
|
log.error(
|
||||||
"Unexpected error on bulk action processing. This error is reported to the caller: {}",
|
"Unexpected error on bulk action processing. This error is reported to the caller: ",
|
||||||
error.getMessage());
|
error);
|
||||||
|
|
||||||
if (error instanceof BulkActionEntityException) {
|
if (error instanceof BulkActionEntityException) {
|
||||||
return new ErrorEntry(
|
return new ErrorEntry(
|
||||||
|
|
|
@ -673,10 +673,15 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
|
||||||
final Long examId) {
|
final Long examId) {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(userSessionId)) {
|
if (StringUtils.isNotBlank(userSessionId)) {
|
||||||
if (StringUtils.isNoneBlank(clientConnection.userSessionId)) {
|
|
||||||
log.warn(
|
if (StringUtils.isNoneBlank(clientConnection.userSessionId)
|
||||||
"ClientConnection integrity violation: clientConnection has already a userSessionId: {} : {}",
|
&& clientConnection.userSessionId.contains(userSessionId)) {
|
||||||
userSessionId, clientConnection);
|
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("SEB sent LMS userSessionId but clientConnection has already a userSessionId");
|
||||||
|
}
|
||||||
|
|
||||||
|
return clientConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to get user account display name
|
// try to get user account display name
|
||||||
|
|
|
@ -376,9 +376,15 @@ public abstract class EntityController<T extends Entity, M extends Entity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final EntityType entityType = this.entityDAO.entityType();
|
final EntityType entityType = this.entityDAO.entityType();
|
||||||
final Collection<EntityKey> sources = ids
|
|
||||||
.stream()
|
final Collection<EntityKey> sources = ids.stream()
|
||||||
.map(this::logDelete)
|
.map(id -> {
|
||||||
|
return this.entityDAO.byModelId(id)
|
||||||
|
.flatMap(exam -> this.validForDelete(exam))
|
||||||
|
.getOr(null);
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(exam -> exam.getModelId())
|
||||||
.map(id -> new EntityKey(id, entityType))
|
.map(id -> new EntityKey(id, entityType))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,11 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Result<Exam> validForDelete(final Exam entity) {
|
||||||
|
return checkNoActiveSEBClientConnections(entity);
|
||||||
|
}
|
||||||
|
|
||||||
private Exam checkExamSupporterRole(final Exam exam) {
|
private Exam checkExamSupporterRole(final Exam exam) {
|
||||||
final Set<String> examSupporter = this.userDAO.all(
|
final Set<String> examSupporter = this.userDAO.all(
|
||||||
this.authorization.getUserService().getCurrentUser().getUserInfo().institutionId,
|
this.authorization.getUserService().getCurrentUser().getUserInfo().institutionId,
|
||||||
|
|
|
@ -457,6 +457,7 @@ sebserver.exam.action.save=Save Exam
|
||||||
sebserver.exam.action.activate=Activate Exam
|
sebserver.exam.action.activate=Activate Exam
|
||||||
sebserver.exam.action.deactivate=Deactivate Exam
|
sebserver.exam.action.deactivate=Deactivate Exam
|
||||||
sebserver.exam.action.delete=Delete Exam
|
sebserver.exam.action.delete=Delete Exam
|
||||||
|
sebserver.exam.action.delete.consistency.error=Deletion Failed.<br/>Please make sure there are no active SEB clients connected to the exam before deletion.
|
||||||
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
sebserver.exam.action.sebrestriction.enable=Apply SEB Lock
|
||||||
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
sebserver.exam.action.sebrestriction.disable=Release SEB Lock
|
||||||
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
sebserver.exam.action.sebrestriction.details=SEB Restriction Details
|
||||||
|
|
Loading…
Reference in a new issue