use of teammates.common.exception.EntityDoesNotExistException in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method deleteInstructorRespondent.
public void deleteInstructorRespondent(String email, String feedbackSessionName, String courseId) throws EntityDoesNotExistException, InvalidParametersException {
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, feedbackSessionName);
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, courseId);
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, email);
FeedbackSessionAttributes sessionToUpdate = getFeedbackSession(feedbackSessionName, courseId);
if (sessionToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + courseId + "/" + feedbackSessionName);
}
fsDb.deleteInstructorRespondent(email, sessionToUpdate);
}
use of teammates.common.exception.EntityDoesNotExistException in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method updateFeedbackSession.
public void updateFeedbackSession(FeedbackSessionAttributes newSession) throws InvalidParametersException, EntityDoesNotExistException {
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, newSession);
FeedbackSessionAttributes oldSession = fsDb.getFeedbackSession(newSession.getCourseId(), newSession.getFeedbackSessionName());
if (oldSession == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + newSession.getCourseId() + "/" + newSession.getFeedbackSessionName());
}
// These can't be changed anyway. Copy values to defensively avoid
// invalid parameters.
newSession.setCreatorEmail(oldSession.getCreatorEmail());
newSession.setCreatedTime(oldSession.getCreatedTime());
if (newSession.getInstructions() == null) {
newSession.setInstructions(oldSession.getInstructions());
}
if (newSession.getStartTime() == null) {
newSession.setStartTime(oldSession.getStartTime());
}
if (newSession.getEndTime() == null) {
newSession.setEndTime(oldSession.getEndTime());
}
if (newSession.getFeedbackSessionType() == null) {
newSession.setFeedbackSessionType(oldSession.getFeedbackSessionType());
}
if (newSession.getSessionVisibleFromTime() == null) {
newSession.setSessionVisibleFromTime(oldSession.getSessionVisibleFromTime());
}
if (newSession.getResultsVisibleFromTime() == null) {
newSession.setResultsVisibleFromTime(oldSession.getResultsVisibleFromTime());
}
makeEmailStateConsistent(oldSession, newSession);
fsDb.updateFeedbackSession(newSession);
}
use of teammates.common.exception.EntityDoesNotExistException in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method clearInstructorRespondents.
public void clearInstructorRespondents(String feedbackSessionName, String courseId) throws EntityDoesNotExistException, InvalidParametersException {
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, feedbackSessionName);
Assumption.assertNotNull(Const.StatusCodes.NULL_PARAMETER, courseId);
FeedbackSessionAttributes sessionToUpdate = getFeedbackSession(feedbackSessionName, courseId);
if (sessionToUpdate == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_UPDATE + courseId + "/" + feedbackSessionName);
}
fsDb.clearInstructorRespondents(sessionToUpdate);
}
use of teammates.common.exception.EntityDoesNotExistException in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method deleteFeedbackSessionCascade.
/**
* Deletes a specific feedback session, and all its question and responses.
*/
public void deleteFeedbackSessionCascade(String feedbackSessionName, String courseId) {
try {
fqLogic.deleteFeedbackQuestionsForSession(feedbackSessionName, courseId);
} catch (EntityDoesNotExistException e) {
// Silently fail if session does not exist
log.warning(TeammatesException.toStringWithStackTrace(e));
}
FeedbackSessionAttributes sessionToDelete = FeedbackSessionAttributes.builder(feedbackSessionName, courseId, "").build();
fsDb.deleteEntity(sessionToDelete);
}
use of teammates.common.exception.EntityDoesNotExistException in project teammates by TEAMMATES.
the class AdminAccountDetailsPageAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
String googleId = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_ID);
AccountAttributes accountInformation = logic.getAccount(googleId);
List<CourseDetailsBundle> instructorCourseList;
try {
instructorCourseList = new ArrayList<>(logic.getCourseSummariesForInstructor(googleId).values());
} catch (EntityDoesNotExistException e) {
// Not an instructor of any course
instructorCourseList = null;
}
List<CourseAttributes> studentCourseList;
try {
studentCourseList = logic.getCoursesForStudentAccount(googleId);
} catch (EntityDoesNotExistException e) {
// Not a student of any course
studentCourseList = null;
}
AdminAccountDetailsPageData data = new AdminAccountDetailsPageData(account, sessionToken, accountInformation, instructorCourseList, studentCourseList);
statusToAdmin = "adminAccountDetails Page Load<br>" + "Viewing details for " + data.getAccountInformation().name + "(" + googleId + ")";
return createShowPageResult(Const.ViewURIs.ADMIN_ACCOUNT_DETAILS, data);
}
Aggregations