code cleanup

This commit is contained in:
anhefti 2021-05-17 14:36:50 +02:00
parent d4aa25a736
commit 0d8fb4b880
3 changed files with 11 additions and 7 deletions

View file

@ -8,8 +8,6 @@
package ch.ethz.seb.sebserver.webservice.servicelayer.lms;
import javax.validation.constraints.NotNull;
import ch.ethz.seb.sebserver.gbl.model.exam.Exam;
import ch.ethz.seb.sebserver.gbl.model.exam.SEBRestriction;
import ch.ethz.seb.sebserver.gbl.util.Result;
@ -55,6 +53,14 @@ public interface SEBRestrictionService {
* @return Result refer to the Exam instance or to an error if happened */
Result<Exam> releaseSEBClientRestriction(Exam exam);
boolean checkConsistency(@NotNull Long lmsSetupId, Exam exam);
/** This checks whether the SEB Restriction is switched on for the given Exam.
* The check only applies if the SEB Restriction feature is switched on
* for the particular LMS type of the Exam. otherwise it returns true to indicate
* everything is fine with SEB Restriction
*
* @param exam the Exam instance to chech
* @return false if the SEB Restriction feature is switched on for the given Exam but the restriction is not applied
* to the LMS */
boolean checkSebRestrictionSet(Exam exam);
}

View file

@ -18,8 +18,6 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -71,7 +69,7 @@ public class SEBRestrictionServiceImpl implements SEBRestrictionService {
}
@Override
public boolean checkConsistency(@NotNull final Long lmsSetupId, final Exam exam) {
public boolean checkSebRestrictionSet(final Exam exam) {
final LmsSetup lmsSetup = this.lmsAPIService
.getLmsSetup(exam.lmsSetupId)
.getOr(null);

View file

@ -148,7 +148,7 @@ public class ExamSessionServiceImpl implements ExamSessionService {
return null;
});
if (!this.sebRestrictionService.checkConsistency(exam.lmsSetupId, exam)) {
if (!this.sebRestrictionService.checkSebRestrictionSet(exam)) {
result.add(
ErrorMessage.EXAM_CONSISTENCY_VALIDATION_SEB_RESTRICTION
.of(exam.getModelId()));