use of teammates.common.exception.InvalidParametersException 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);
}
use of teammates.common.exception.InvalidParametersException in project teammates by TEAMMATES.
the class StudentProfileEditSaveAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
try {
account.studentProfile = extractProfileData();
logic.updateStudentProfile(account.studentProfile);
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_EDITED, StatusMessageColor.SUCCESS));
statusToAdmin = "Student Profile for <span class=\"bold\">(" + account.googleId + ")</span> edited.<br>" + SanitizationHelper.sanitizeForHtmlTag(account.studentProfile.toString());
} catch (InvalidParametersException ipe) {
setStatusForException(ipe);
}
return createRedirectResult(Const.ActionURIs.STUDENT_PROFILE_PAGE);
}
use of teammates.common.exception.InvalidParametersException in project teammates by TEAMMATES.
the class StudentProfilePictureAction method handleRequestWithEmailAndCourse.
private ActionResult handleRequestWithEmailAndCourse() throws EntityDoesNotExistException {
String email;
String courseId;
try {
email = getStudentEmailFromRequest();
courseId = getCourseIdFromRequest();
} catch (InvalidParametersException e) {
log.warning("Attempting to decrypt malformed ciphertext when retrieving email or course id from request.");
throw new EntityDoesNotExistException(e);
}
log.info("email: " + email + ", course: " + courseId);
StudentAttributes student = getStudentForGivenParameters(courseId, email);
gateKeeper.verifyAccessibleForCurrentUserAsInstructorOrTeamMemberOrAdmin(account, courseId, student.section, email);
return createImageResult(getPictureKeyForStudent(student));
}
Aggregations