public CandidateEvent recordCandidateItemEvent(
      final CandidateSession candidateSession,
      final CandidateItemEventType itemEventType,
      final ItemSessionState itemSessionState,
      final NotificationRecorder notificationRecorder) {
    /* Create event */
    final CandidateEvent event = new CandidateEvent();
    event.setCandidateSession(candidateSession);
    event.setItemEventType(itemEventType);
    event.setTimestamp(requestTimestampContext.getCurrentRequestTimestamp());

    /* Store event */
    candidateEventDao.persist(event);

    /* Save current ItemSessionState */
    storeItemSessionState(event, itemSessionState);

    /* Now store processing notifications */
    if (notificationRecorder != null) {
      for (final Notification notification : notificationRecorder.getNotifications()) {
        recordNotification(event, notification);
      }
    }

    return event;
  }
 public AssessmentResult computeTestAssessmentResult(
     final CandidateSession candidateSession, final TestSessionController testSessionController) {
   final URI sessionIdentifierSourceId = URI.create(qtiWorksDeploymentSettings.getBaseUrl());
   final String sessionIdentifier = "testsession/" + candidateSession.getId();
   return testSessionController.computeAssessmentResult(
       requestTimestampContext.getCurrentRequestTimestamp(),
       sessionIdentifier,
       sessionIdentifierSourceId);
 }
  public CandidateEvent recordCandidateTestEvent(
      final CandidateSession candidateSession,
      final CandidateTestEventType testEventType,
      final CandidateItemEventType itemEventType,
      final TestPlanNodeKey itemKey,
      final TestSessionState testSessionState,
      final NotificationRecorder notificationRecorder) {
    Assert.notNull(candidateSession, "candidateSession");
    Assert.notNull(testEventType, "testEventType");
    Assert.notNull(testSessionState, "testSessionState");

    /* Create event */
    final CandidateEvent event = new CandidateEvent();
    event.setCandidateSession(candidateSession);
    event.setTestEventType(testEventType);
    event.setItemEventType(itemEventType);
    if (itemKey != null) {
      event.setTestItemKey(itemKey.toString());
    }
    event.setTimestamp(requestTimestampContext.getCurrentRequestTimestamp());

    /* Store event */
    candidateEventDao.persist(event);

    /* Store test session state */
    storeTestSessionState(event, testSessionState);

    /* Now store processing notifications */
    if (notificationRecorder != null) {
      for (final Notification notification : notificationRecorder.getNotifications()) {
        recordNotification(event, notification);
      }
    }

    return event;
  }