preparation for Ans Delft LMS binding implementation
This commit is contained in:
parent
2e74ea1b7b
commit
d111fd4f49
2 changed files with 16 additions and 16 deletions
|
@ -6,7 +6,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* 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.ArrayList;
|
||||||
import java.util.Collection;
|
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.LmsAPITemplate;
|
||||||
import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.AbstractCachedCourseAccess;
|
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
|
// TODO add needed dependencies here
|
||||||
private final APITemplateDataSupplier apiTemplateDataSupplier;
|
private final APITemplateDataSupplier apiTemplateDataSupplier;
|
||||||
private final Long lmsSetupId;
|
private final Long lmsSetupId;
|
||||||
|
|
||||||
protected OlatLmsAPITemplate(
|
protected AnsLmsAPITemplate(
|
||||||
// TODO if you need more dependencies inject them here and set the reference
|
// TODO if you need more dependencies inject them here and set the reference
|
||||||
final APITemplateDataSupplier apiTemplateDataSupplier,
|
final APITemplateDataSupplier apiTemplateDataSupplier,
|
||||||
final AsyncService asyncService,
|
final AsyncService asyncService,
|
||||||
|
@ -63,7 +63,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LmsType getType() {
|
public LmsType getType() {
|
||||||
return LmsType.OPEN_OLAT;
|
return LmsType.ANS_DELFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -86,7 +86,7 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
||||||
// TODO check if the course API of the remote LMS is available
|
// TODO check if the course API of the remote LMS is available
|
||||||
// if not, create corresponding LmsSetupTestResult error
|
// if not, create corresponding LmsSetupTestResult error
|
||||||
|
|
||||||
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
|
return LmsSetupTestResult.ofOkay(LmsType.ANS_DELFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,14 +96,14 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
||||||
return testLmsSetupSettings;
|
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
|
// TODO check if the course API of the remote LMS is available
|
||||||
// if not, create corresponding LmsSetupTestResult error
|
// if not, create corresponding LmsSetupTestResult error
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return LmsSetupTestResult.ofOkay(LmsType.OPEN_OLAT);
|
return LmsSetupTestResult.ofOkay(LmsType.ANS_DELFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LmsSetupTestResult testLmsSetupSettings() {
|
private LmsSetupTestResult testLmsSetupSettings() {
|
||||||
|
@ -141,10 +141,10 @@ public class OlatLmsAPITemplate extends AbstractCachedCourseAccess implements Lm
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missingAttrs.isEmpty()) {
|
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
|
@Override
|
|
@ -6,7 +6,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* 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.cache.CacheManager;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
@ -24,20 +24,20 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplateFactory;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@WebServiceProfile
|
@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
|
* 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
|
* can exist per defined LMSSetup, we need a specialized factory to build such
|
||||||
* a LmsAPITemplate for a specific LMSSetup.
|
* a LmsAPITemplate for a specific LMSSetup.
|
||||||
* </p<
|
* </p<
|
||||||
* Add needed dependencies as final fields and let them inject within the constructor
|
* 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. */
|
* as usual. Just add the additionally needed dependencies used to build a AnsLmsAPITemplateFactory */
|
||||||
public class OlatLmsAPITemplateFactory implements LmsAPITemplateFactory {
|
public class AnsLmsAPITemplateFactory implements LmsAPITemplateFactory {
|
||||||
|
|
||||||
private final AsyncService asyncService;
|
private final AsyncService asyncService;
|
||||||
private final Environment environment;
|
private final Environment environment;
|
||||||
private final CacheManager cacheManager;
|
private final CacheManager cacheManager;
|
||||||
|
|
||||||
public OlatLmsAPITemplateFactory(
|
public AnsLmsAPITemplateFactory(
|
||||||
final AsyncService asyncService,
|
final AsyncService asyncService,
|
||||||
final Environment environment,
|
final Environment environment,
|
||||||
final CacheManager cacheManager) {
|
final CacheManager cacheManager) {
|
||||||
|
@ -49,13 +49,13 @@ public class OlatLmsAPITemplateFactory implements LmsAPITemplateFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LmsType lmsType() {
|
public LmsType lmsType() {
|
||||||
return LmsType.OPEN_OLAT;
|
return LmsType.ANS_DELFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<LmsAPITemplate> create(final APITemplateDataSupplier apiTemplateDataSupplier) {
|
public Result<LmsAPITemplate> create(final APITemplateDataSupplier apiTemplateDataSupplier) {
|
||||||
return Result.tryCatch(() -> {
|
return Result.tryCatch(() -> {
|
||||||
return new OlatLmsAPITemplate(
|
return new AnsLmsAPITemplate(
|
||||||
apiTemplateDataSupplier,
|
apiTemplateDataSupplier,
|
||||||
this.asyncService,
|
this.asyncService,
|
||||||
this.environment,
|
this.environment,
|
Loading…
Reference in a new issue