Search in sources :

Example 1 with ItemProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap in project OpenOLAT by OpenOLAT.

the class QTI21ItemBodyController 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));
    sessionController.initialize(new Date());
    return sessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) 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)

Example 2 with ItemProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap in project openolat by klemens.

the class AssessmentItemDisplayController method createNewItemSessionStateAndController.

public ItemSessionController createNewItemSessionStateAndController(NotificationRecorder notificationRecorder) {
    /* Resolve the underlying JQTI+ object */
    final ItemProcessingMap itemProcessingMap = getItemProcessingMap();
    if (itemProcessingMap == null) {
        return null;
    }
    /* Create fresh state for session */
    final ItemSessionState itemSessionState = new ItemSessionState();
    /* Create config for ItemSessionController */
    final ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings();
    itemSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    itemSessionControllerSettings.setMaxAttempts(10);
    /* Create controller and wire up notification recorder */
    final ItemSessionController result = new ItemSessionController(qtiService.jqtiExtensionManager(), itemSessionControllerSettings, itemProcessingMap, itemSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController)

Example 3 with ItemProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap in project openolat by klemens.

the class QTI21ItemBodyController 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));
    sessionController.initialize(new Date());
    return sessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) 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)

Example 4 with ItemProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap in project OpenOLAT by OpenOLAT.

the class RunningItemHelper method run.

public static ItemSessionController run(URI inputUri, Map<Identifier, ResponseData> responseMap, ResourceLocator inputResourceLocator) {
    SimpleJqtiFacade simpleJqtiFacade = new SimpleJqtiFacade();
    ResolvedAssessmentItem resolvedAssessmentItem = simpleJqtiFacade.loadAndResolveAssessmentItem(inputResourceLocator, inputUri);
    ItemProcessingMap itemProcessingMap = new ItemProcessingInitializer(resolvedAssessmentItem, false).initialize();
    ItemSessionState itemSessionState = new ItemSessionState();
    ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings();
    ItemSessionController itemSessionController = simpleJqtiFacade.createItemSessionController(itemSessionControllerSettings, itemProcessingMap, itemSessionState);
    itemSessionController.initialize(new Date());
    itemSessionController.performTemplateProcessing(new Date());
    itemSessionController.enterItem(new Date());
    itemSessionController.bindResponses(new Date(), responseMap);
    itemSessionController.commitResponses(new Date());
    itemSessionController.performResponseProcessing(new Date());
    AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
    assessmentItem.getItemBody().willShowFeedback(itemSessionController);
    itemSessionController.endItem(new Date());
    itemSessionController.exitItem(new Date());
    return itemSessionController;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemProcessingInitializer(uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentItem(uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController) SimpleJqtiFacade(uk.ac.ed.ph.jqtiplus.SimpleJqtiFacade) Date(java.util.Date)

Example 5 with ItemProcessingMap

use of uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap in project OpenOLAT by OpenOLAT.

the class AssessmentItemDisplayController method createNewItemSessionStateAndController.

public ItemSessionController createNewItemSessionStateAndController(NotificationRecorder notificationRecorder) {
    /* Resolve the underlying JQTI+ object */
    final ItemProcessingMap itemProcessingMap = getItemProcessingMap();
    if (itemProcessingMap == null) {
        return null;
    }
    /* Create fresh state for session */
    final ItemSessionState itemSessionState = new ItemSessionState();
    /* Create config for ItemSessionController */
    final ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings();
    itemSessionControllerSettings.setTemplateProcessingLimit(computeTemplateProcessingLimit());
    itemSessionControllerSettings.setMaxAttempts(10);
    /* Create controller and wire up notification recorder */
    final ItemSessionController result = new ItemSessionController(qtiService.jqtiExtensionManager(), itemSessionControllerSettings, itemProcessingMap, itemSessionState);
    if (notificationRecorder != null) {
        result.addNotificationListener(notificationRecorder);
    }
    return result;
}
Also used : ItemSessionControllerSettings(uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings) ItemProcessingMap(uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap) ItemSessionState(uk.ac.ed.ph.jqtiplus.state.ItemSessionState) ItemSessionController(uk.ac.ed.ph.jqtiplus.running.ItemSessionController)

Aggregations

ItemSessionController (uk.ac.ed.ph.jqtiplus.running.ItemSessionController)8 ItemSessionControllerSettings (uk.ac.ed.ph.jqtiplus.running.ItemSessionControllerSettings)8 ItemProcessingMap (uk.ac.ed.ph.jqtiplus.state.ItemProcessingMap)8 ItemSessionState (uk.ac.ed.ph.jqtiplus.state.ItemSessionState)8 Date (java.util.Date)6 ItemProcessingInitializer (uk.ac.ed.ph.jqtiplus.running.ItemProcessingInitializer)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