From 94c04805e0647f3ec33fa9ee3b8513fc78e4e9ef Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 7 Feb 2022 17:08:01 +0100 Subject: [PATCH] SEBSERV-155 removed mandatory supporter application and check --- src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java | 2 -- .../ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java | 5 ++--- .../servicelayer/session/impl/ExamSessionServiceImpl.java | 5 ++++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java index ae91d57a..51bb37f3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/exam/Exam.java @@ -13,7 +13,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; -import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import org.apache.commons.lang3.StringUtils; @@ -115,7 +114,6 @@ public final class Exam implements GrantEntity { public final String owner; @JsonProperty(EXAM.ATTR_SUPPORTER) - @NotEmpty(message = "exam:supporter:notNull") public final Collection supporter; @JsonProperty(EXAM.ATTR_STATUS) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java index 143df91b..144c9fab 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/exam/ExamForm.java @@ -357,7 +357,7 @@ public class ExamForm implements TemplateComposer { .withLabelSpan(2) .withInputSpan(4) .withEmptyCellSpan(2) - .mandatory(!readonly)) + .readonly(!importFromQuizData)) .addField(FormBuilder.singleSelection( Domain.EXAM.ATTR_TYPE, @@ -376,8 +376,7 @@ public class ExamForm implements TemplateComposer { this.resourceService::examSupporterResources) .withLabelSpan(2) .withInputSpan(4) - .withEmptyCellSpan(2) - .mandatory(!readonly)) + .withEmptyCellSpan(2)) .buildFor(importFromQuizData ? this.restService.getRestCall(ImportAsExam.class) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 89645318..c172a014 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -63,6 +63,7 @@ public class ExamSessionServiceImpl implements ExamSessionService { private final ExamConfigurationMapDAO examConfigurationMapDAO; private final CacheManager cacheManager; private final SEBRestrictionService sebRestrictionService; + private final boolean checkExamSupporter; private final boolean distributedSetup; private final long distributedConnectionUpdate; @@ -76,6 +77,7 @@ public class ExamSessionServiceImpl implements ExamSessionService { final IndicatorDAO indicatorDAO, final CacheManager cacheManager, final SEBRestrictionService sebRestrictionService, + @Value("${sebserver.webservice.exam.check.supporter:false}") final boolean checkExamSupporter, @Value("${sebserver.webservice.distributed:false}") final boolean distributedSetup, @Value("${sebserver.webservice.distributed.connectionUpdate:2000}") final long distributedConnectionUpdate) { @@ -86,6 +88,7 @@ public class ExamSessionServiceImpl implements ExamSessionService { this.cacheManager = cacheManager; this.indicatorDAO = indicatorDAO; this.sebRestrictionService = sebRestrictionService; + this.checkExamSupporter = checkExamSupporter; this.distributedSetup = distributedSetup; this.distributedConnectionUpdate = distributedConnectionUpdate; } @@ -136,7 +139,7 @@ public class ExamSessionServiceImpl implements ExamSessionService { if (exam.status == ExamStatus.RUNNING) { // check exam supporter - if (exam.getSupporter().isEmpty()) { + if (this.checkExamSupporter && exam.getSupporter().isEmpty()) { result.add(ErrorMessage.EXAM_CONSISTENCY_VALIDATION_SUPPORTER.of(exam.getModelId())); }