Search in sources :

Example 1 with ExamSession

use of de.tum.in.www1.artemis.domain.exam.ExamSession in project ArTEMiS by ls1intum.

the class ExamSessionService method startExamSession.

/**
 * Creates and saves an exam session for given student exam
 *
 * @param studentExam student exam for which an exam session shall be created
 * @param fingerprint the browser fingerprint reported by the client, can be null
 * @param userAgent the user agent of the client, can be null
 * @param instanceId the instance id of the client, can be null
 * @param ipAddress the ip address of the client, can be null
 * @return the newly create exam session
 */
public ExamSession startExamSession(StudentExam studentExam, @Nullable String fingerprint, @Nullable String userAgent, @Nullable String instanceId, @Nullable IPAddress ipAddress) {
    log.debug("Exam session started");
    String sessionToken = generateSafeToken();
    ExamSession examSession = new ExamSession();
    examSession.setSessionToken(sessionToken);
    examSession.setStudentExam(studentExam);
    examSession.setBrowserFingerprintHash(fingerprint);
    examSession.setUserAgent(userAgent);
    examSession.setInstanceId(instanceId);
    examSession.setIpAddress(ipAddress);
    examSession = examSessionRepository.save(examSession);
    return examSession;
}
Also used : ExamSession(de.tum.in.www1.artemis.domain.exam.ExamSession)

Example 2 with ExamSession

use of de.tum.in.www1.artemis.domain.exam.ExamSession in project Artemis by ls1intum.

the class ExamSessionService method startExamSession.

/**
 * Creates and saves an exam session for given student exam
 *
 * @param studentExam student exam for which an exam session shall be created
 * @param fingerprint the browser fingerprint reported by the client, can be null
 * @param userAgent the user agent of the client, can be null
 * @param instanceId the instance id of the client, can be null
 * @param ipAddress the ip address of the client, can be null
 * @return the newly create exam session
 */
public ExamSession startExamSession(StudentExam studentExam, @Nullable String fingerprint, @Nullable String userAgent, @Nullable String instanceId, @Nullable IPAddress ipAddress) {
    log.debug("Exam session started");
    String sessionToken = generateSafeToken();
    ExamSession examSession = new ExamSession();
    examSession.setSessionToken(sessionToken);
    examSession.setStudentExam(studentExam);
    examSession.setBrowserFingerprintHash(fingerprint);
    examSession.setUserAgent(userAgent);
    examSession.setInstanceId(instanceId);
    examSession.setIpAddress(ipAddress);
    examSession = examSessionRepository.save(examSession);
    return examSession;
}
Also used : ExamSession(de.tum.in.www1.artemis.domain.exam.ExamSession)

Aggregations

ExamSession (de.tum.in.www1.artemis.domain.exam.ExamSession)2