From a7d3b51005042631a3aa991ee5aca37830ac8b1d Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 19 May 2021 13:51:23 +0200 Subject: [PATCH] OpenOLAT LMS binding preparation --- .../sebserver/gbl/model/institution/LmsSetup.java | 2 +- .../lms/impl/olat/OlatLmsAPITemplate.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java index 595ca273..29c14a5a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/institution/LmsSetup.java @@ -63,7 +63,7 @@ public final class LmsSetup implements GrantEntity, Activatable { /** The Ans Delft binding is on the way */ ANS_DELFT(/* Features.COURSE_API , Features.SEB_RESTRICTION */), /** The OpenOLAT binding is on the way */ - OPEN_OLAT(/* Features.COURSE_API , Features.SEB_RESTRICTION */); + OPEN_OLAT(Features.COURSE_API, Features.SEB_RESTRICTION); public final EnumSet features; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java index b25519f8..35be346a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplate.java @@ -83,12 +83,15 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm final LmsSetupTestResult testLmsSetupSettings = testLmsSetupSettings(); if (testLmsSetupSettings.hasAnyError()) { return testLmsSetupSettings; + } else { + } // TODO check if the course API of the remote LMS is available // if not, create corresponding LmsSetupTestResult error + return LmsSetupTestResult.ofQuizAccessAPIError(LmsType.OPEN_OLAT, "TODO: implement LMS access check"); - return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT); + //return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT); } @Override @@ -196,8 +199,11 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm final String quizName = filterMap.getString(QuizData.FILTER_ATTR_QUIZ_NAME); final DateTime quizFromTime = (filterMap != null) ? filterMap.getQuizFromTime() : null; - // TODO get all course / quiz data from remote LMS that matches the filter criteria. - // put loaded QuizData to the cache: super.putToCache(quizDataCollection); + // TODO Get all course / quiz data from remote LMS that matches the filter criteria. + // If the LMS API uses paging, go through all pages using the filter criteria + // and collect the course data. + // Transform the data from courses / quizzes from LMS into QuizData objects + // Put loaded QuizData objects to the cache: super.putToCache(quizDataCollection); // before returning it. return () -> { @@ -209,6 +215,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm protected Supplier> quizzesSupplier(final Set ids) { // TODO get all quiz / course data for specified identifiers from remote LMS + // Transform the data from courses / quizzes from LMS into QuizData objects // and put it to the cache: super.putToCache(quizDataCollection); // before returning it.