Search in sources :

Example 6 with AssessmentModeImpl

use of org.olat.course.assessment.model.AssessmentModeImpl in project openolat by klemens.

the class AssessmentModeManagerImpl method merge.

@Override
public AssessmentMode merge(AssessmentMode assessmentMode, boolean forceStatus) {
    assessmentMode.setLastModified(new Date());
    // update begin with lead time
    Date begin = assessmentMode.getBegin();
    Date beginWithLeadTime = evaluateLeadTime(begin, assessmentMode.getLeadTime());
    ((AssessmentModeImpl) assessmentMode).setBeginWithLeadTime(beginWithLeadTime);
    Date end = assessmentMode.getEnd();
    Date endWithFollowupTime = evaluateFollowupTime(end, assessmentMode.getFollowupTime());
    ((AssessmentModeImpl) assessmentMode).setEndWithFollowupTime(endWithFollowupTime);
    AssessmentMode reloadedMode;
    if (assessmentMode.getKey() == null) {
        dbInstance.getCurrentEntityManager().persist(assessmentMode);
        reloadedMode = assessmentMode;
    } else {
        reloadedMode = dbInstance.getCurrentEntityManager().merge(assessmentMode);
    }
    dbInstance.commit();
    if (reloadedMode.isManualBeginEnd()) {
        reloadedMode = assessmentModeCoordinationService.syncManuallySetStatus(reloadedMode, forceStatus);
    } else {
        reloadedMode = assessmentModeCoordinationService.syncAutomicallySetStatus(reloadedMode);
    }
    return reloadedMode;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) AssessmentMode(org.olat.course.assessment.AssessmentMode) Date(java.util.Date)

Example 7 with AssessmentModeImpl

use of org.olat.course.assessment.model.AssessmentModeImpl in project OpenOLAT by OpenOLAT.

the class AssessmentModeManagerImpl method persist.

@Override
public AssessmentMode persist(AssessmentMode assessmentMode) {
    assessmentMode.setLastModified(new Date());
    // update begin with lead time
    Date begin = assessmentMode.getBegin();
    Date beginWithLeadTime = evaluateLeadTime(begin, assessmentMode.getLeadTime());
    ((AssessmentModeImpl) assessmentMode).setBeginWithLeadTime(beginWithLeadTime);
    Date end = assessmentMode.getEnd();
    Date endWithFollowupTime = this.evaluateFollowupTime(end, assessmentMode.getFollowupTime());
    ((AssessmentModeImpl) assessmentMode).setEndWithFollowupTime(endWithFollowupTime);
    dbInstance.getCurrentEntityManager().persist(assessmentMode);
    dbInstance.commit();
    return assessmentMode;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Example 8 with AssessmentModeImpl

use of org.olat.course.assessment.model.AssessmentModeImpl in project OpenOLAT by OpenOLAT.

the class AssessmentModeManagerImpl method createAssessmentMode.

@Override
public AssessmentMode createAssessmentMode(RepositoryEntry entry) {
    AssessmentModeImpl mode = new AssessmentModeImpl();
    mode.setCreationDate(new Date());
    mode.setLastModified(new Date());
    mode.setRepositoryEntry(entry);
    mode.setStatus(Status.none);
    mode.setManualBeginEnd(false);
    return mode;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Example 9 with AssessmentModeImpl

use of org.olat.course.assessment.model.AssessmentModeImpl in project openolat by klemens.

the class AssessmentModeManagerImpl method persist.

@Override
public AssessmentMode persist(AssessmentMode assessmentMode) {
    assessmentMode.setLastModified(new Date());
    // update begin with lead time
    Date begin = assessmentMode.getBegin();
    Date beginWithLeadTime = evaluateLeadTime(begin, assessmentMode.getLeadTime());
    ((AssessmentModeImpl) assessmentMode).setBeginWithLeadTime(beginWithLeadTime);
    Date end = assessmentMode.getEnd();
    Date endWithFollowupTime = this.evaluateFollowupTime(end, assessmentMode.getFollowupTime());
    ((AssessmentModeImpl) assessmentMode).setEndWithFollowupTime(endWithFollowupTime);
    dbInstance.getCurrentEntityManager().persist(assessmentMode);
    dbInstance.commit();
    return assessmentMode;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Example 10 with AssessmentModeImpl

use of org.olat.course.assessment.model.AssessmentModeImpl in project openolat by klemens.

the class AssessmentModeManagerImpl method createAssessmentMode.

@Override
public AssessmentMode createAssessmentMode(RepositoryEntry entry) {
    AssessmentModeImpl mode = new AssessmentModeImpl();
    mode.setCreationDate(new Date());
    mode.setLastModified(new Date());
    mode.setRepositoryEntry(entry);
    mode.setStatus(Status.none);
    mode.setManualBeginEnd(false);
    return mode;
}
Also used : AssessmentModeImpl(org.olat.course.assessment.model.AssessmentModeImpl) Date(java.util.Date)

Aggregations

AssessmentModeImpl (org.olat.course.assessment.model.AssessmentModeImpl)10 Date (java.util.Date)8 AssessmentMode (org.olat.course.assessment.AssessmentMode)2