preparation for Ans Delft LMS binding implementation

This commit is contained in:
anhefti 2021-05-18 08:57:31 +02:00
parent 2e74ea1b7b
commit d111fd4f49
2 changed files with 16 additions and 16 deletions

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.olat;
package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.ans;
import java.util.ArrayList;
import java.util.Collection;
@ -42,13 +42,13 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPIService;
import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplate;
import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.AbstractCachedCourseAccess;
public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements LmsAPITemplate {
public class AnsLmsAPITemplate extends AbstractCachedCourseAccess implements LmsAPITemplate {
// TODO add needed dependencies here
private final APITemplateDataSupplier apiTemplateDataSupplier;
private final Long lmsSetupId;
protected OlatLmsAPITemplate(
protected AnsLmsAPITemplate(
// TODO if you need more dependencies inject them here and set the reference
final APITemplateDataSupplier apiTemplateDataSupplier,
final AsyncService asyncService,
@ -63,7 +63,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
@Override
public LmsType getType() {
return LmsType.OPEN_OLAT;
return LmsType.ANS_DELFT;
}
@Override
@ -86,7 +86,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
// TODO check if the course API of the remote LMS is available
// if not, create corresponding LmsSetupTestResult error
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
return LmsSetupTestResult.ofOkay(LmsType.ANS_DELFT);
}
@Override
@ -96,14 +96,14 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
return testLmsSetupSettings;
}
if (LmsType.OPEN_OLAT.features.contains(Features.SEB_RESTRICTION)) {
if (LmsType.ANS_DELFT.features.contains(Features.SEB_RESTRICTION)) {
// TODO check if the course API of the remote LMS is available
// if not, create corresponding LmsSetupTestResult error
}
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
return LmsSetupTestResult.ofOkay(LmsType.ANS_DELFT);
}
private LmsSetupTestResult testLmsSetupSettings() {
@ -141,10 +141,10 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
}
if (!missingAttrs.isEmpty()) {
return LmsSetupTestResult.ofMissingAttributes(LmsType.OPEN_OLAT, missingAttrs);
return LmsSetupTestResult.ofMissingAttributes(LmsType.ANS_DELFT, missingAttrs);
}
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
return LmsSetupTestResult.ofOkay(LmsType.ANS_DELFT);
}
@Override

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.olat;
package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.ans;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Lazy;
@ -24,20 +24,20 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplateFactory;
@Lazy
@Service
@WebServiceProfile
/** Factory for OlatLmsAPITemplate. Since a LmsAPITemplate of a specific LMS type
/** Factory for AnsLmsAPITemplateFactory Since a LmsAPITemplate of a specific LMS type
* is whether a singleton component nor a simple prototype but one (singleton) instance
* can exist per defined LMSSetup, we need a specialized factory to build such
* a LmsAPITemplate for a specific LMSSetup.
* </p<
* Add needed dependencies as final fields and let them inject within the constructor
* as usual. Just add the additionally needed dependencies used to build a OlatLmsAPITemplate. */
public class OlatLmsAPITemplateFactory implements LmsAPITemplateFactory {
* as usual. Just add the additionally needed dependencies used to build a AnsLmsAPITemplateFactory */
public class AnsLmsAPITemplateFactory implements LmsAPITemplateFactory {
private final AsyncService asyncService;
private final Environment environment;
private final CacheManager cacheManager;
public OlatLmsAPITemplateFactory(
public AnsLmsAPITemplateFactory(
final AsyncService asyncService,
final Environment environment,
final CacheManager cacheManager) {
@ -49,13 +49,13 @@ public class OlatLmsAPITemplateFactory implements LmsAPITemplateFactory {
@Override
public LmsType lmsType() {
return LmsType.OPEN_OLAT;
return LmsType.ANS_DELFT;
}
@Override
public Result<LmsAPITemplate> create(final APITemplateDataSupplier apiTemplateDataSupplier) {
return Result.tryCatch(() -> {
return new OlatLmsAPITemplate(
return new AnsLmsAPITemplate(
apiTemplateDataSupplier,
this.asyncService,
this.environment,