use of teammates.storage.entity.Course in project teammates by TEAMMATES.
the class CoursesDb method updateCourse.
/**
* Updates the course.<br>
* Updates only name and course archive status.<br>
* Preconditions: <br>
* * {@code courseToUpdate} is non-null.<br>
*/
public void updateCourse(CourseAttributes courseToUpdate) throws InvalidParametersException, EntityDoesNotExistException {
Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseToUpdate);
courseToUpdate.sanitizeForSaving();
if (!courseToUpdate.isValid()) {
throw new InvalidParametersException(courseToUpdate.getInvalidityInfo());
}
Course courseEntityToUpdate = getCourseEntity(courseToUpdate.getId());
if (courseEntityToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT_COURSE);
}
courseEntityToUpdate.setName(courseToUpdate.getName());
courseEntityToUpdate.setTimeZone(courseToUpdate.getTimeZone().getId());
saveEntity(courseEntityToUpdate, courseToUpdate);
}
Aggregations