use of teammates.ui.pagedata.PageData in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionEditAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
String editType = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE);
try {
if ("edit".equals(editType)) {
String questionText = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_TEXT);
Assumption.assertNotEmpty("Empty question text", questionText);
FeedbackQuestionAttributes updatedQuestion = extractFeedbackQuestionData();
editQuestion(updatedQuestion);
} else if ("delete".equals(editType)) {
// branch not tested because if it's not edit or delete, Assumption.fail will cause test failure
deleteQuestion();
} else {
// Assumption.fails are not tested
Assumption.fail("Invalid editType");
}
} catch (InvalidParametersException e) {
// This part is not tested because GateKeeper handles if this happens, would be
// extremely difficult to replicate a situation whereby it gets past GateKeeper
setStatusForException(e);
}
return createRedirectResult(new PageData(account, sessionToken).getInstructorFeedbackEditLink(courseId, feedbackSessionName));
}
Aggregations