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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations