Search in sources :

Example 6 with ItemProcessingInitializer

use of uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer in project openolat by klemens.

the class UnkownItemEditorController method createNewItemSessionStateAndController.

private ItemSessionController createNewItemSessionStateAndController() {
    /* Resolve the underlying JQTI+ object */
    final ItemProcessingMap itemProcessingMap = new ItemProcessingInitializer(resolvedAssessmentItem, true).initialize();
    /* Create fresh state for session */
    final ItemSessionState itemSessionState = new ItemSessionState();
    final ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings();
    itemSessionControllerSettings.setTemplateProcessingLimit(25);
    itemSessionControllerSettings.setMaxAttempts(10);
    /* Create controller and wire up notification recorder */
    final ItemSessionController sessionController = new ItemSessionController(qtiService.jqtiExtensionManager(), itemSessionControllerSettings, itemProcessingMap, itemSessionState);
    sessionController.addNotificationListener(new NotificationRecorder(NotificationLevel.ERROR));
    Long randomSeed = new Random().nextLong();
    sessionController.setRandomSeed(randomSeed);
    sessionController.initialize(new Date());
    sessionController.performTemplateProcessing(new Date());
    return sessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) Random(java.util.Random) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) NotificationRecorder(uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder) ItemProcessingInitializer(uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) Date(java.util.Date)

Aggregations

Date (java.util.Date)6 ItemProcessingInitializer (uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer)6 ItemSessionController (uk.ac.ed.ph.jqtiplus.running.ItemSessionController)6 ItemSessionControllerSettings (uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings)6 ItemProcessingMap (uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap)6 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)6 NotificationRecorder (uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder)4 Random (java.util.Random)2 SimpleJqtiFacade (uk.ac.ed.ph.jqtiplus.SimpleJqtiFacade)2 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)2 ResolvedAssessmentItem (uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem)2