public AssessmentResult computeAssessmentResult(final CandidateEvent candidateEvent) { final AssessmentObjectType assessmentType = candidateEvent.getCandidateSession().getDelivery().getAssessment().getAssessmentType(); switch (assessmentType) { case ASSESSMENT_ITEM: final ItemSessionController itemSessionController = createItemSessionController(candidateEvent, null); return computeItemAssessmentResult( candidateEvent.getCandidateSession(), itemSessionController); case ASSESSMENT_TEST: final TestSessionController testSessionController = createTestSessionController(candidateEvent, null); return computeTestAssessmentResult( candidateEvent.getCandidateSession(), testSessionController); default: throw new QtiWorksLogicException("Unexpected switch case " + assessmentType); } }
private File getSessionStateFile(final CandidateEvent candidateEvent) { final CandidateSession candidateSession = candidateEvent.getCandidateSession(); final AssessmentObjectType assessmentType = candidateSession.getDelivery().getAssessment().getAssessmentType(); final String stateFileBaseName = assessmentType == AssessmentObjectType.ASSESSMENT_ITEM ? "itemSessionState" : "testSessionState"; final File sessionFolder = filespaceManager.obtainCandidateSessionStateStore(candidateSession); final String stateFileName = stateFileBaseName + candidateEvent.getId() + ".xml"; return new File(sessionFolder, stateFileName); }
/** * Extracts the {@link TestSessionState} corresponding to the given {@link CandidateEvent} and * wraps it in a {@link TestSessionController}. * * <p>It is assumed that the test was runnable, so this will never return null. */ public TestSessionController createTestSessionController( final CandidateEvent candidateEvent, final NotificationRecorder notificationRecorder) { final TestSessionState testSessionState = loadTestSessionState(candidateEvent); return createTestSessionController( candidateEvent.getCandidateSession(), testSessionState, notificationRecorder); }
/** * Extracts the {@link ItemSessionState} corresponding to the given {@link CandidateEvent} and * wraps it in a {@link ItemSessionController}. * * <p>It is assumed that the item was runnable, so this will never return null. */ public ItemSessionController createItemSessionController( final CandidateEvent candidateEvent, final NotificationRecorder notificationRecorder) { final ItemSessionState itemSessionState = loadItemSessionState(candidateEvent); return createItemSessionController( candidateEvent.getCandidateSession(), itemSessionState, notificationRecorder); }