public void updateFeedbackResponsesForChangingSection( String courseId, String userEmail, String oldSection, String newSection) throws EntityDoesNotExistException, InvalidParametersException { List<FeedbackResponseAttributes> responsesFromUser = getFeedbackResponsesFromGiverForCourse(courseId, userEmail); for (FeedbackResponseAttributes response : responsesFromUser) { response.giverSection = newSection; frDb.updateFeedbackResponse(response); frcLogic.updateFeedbackResponseCommentsForResponse(response.getId()); } List<FeedbackResponseAttributes> responsesToUser = getFeedbackResponsesForReceiverForCourse(courseId, userEmail); for (FeedbackResponseAttributes response : responsesToUser) { response.recipientSection = newSection; frDb.updateFeedbackResponse(response); frcLogic.updateFeedbackResponseCommentsForResponse(response.getId()); } }
public void updateFeedbackResponseForChangingSection( StudentEnrollDetails enrollment, FeedbackResponseAttributes response) throws InvalidParametersException, EntityDoesNotExistException { FeedbackResponse feedbackResponse = frDb.getFeedbackResponseEntityOptimized(response); boolean isGiverSameForResponseAndEnrollment = feedbackResponse.getGiverEmail().equals(enrollment.email); boolean isReceiverSameForResponseAndEnrollment = feedbackResponse.getRecipientEmail().equals(enrollment.email); if (isGiverSameForResponseAndEnrollment) { feedbackResponse.setGiverSection(enrollment.newSection); } if (isReceiverSameForResponseAndEnrollment) { feedbackResponse.setRecipientSection(enrollment.newSection); } frDb.commitOutstandingChanges(); if (isGiverSameForResponseAndEnrollment || isReceiverSameForResponseAndEnrollment) { frcLogic.updateFeedbackResponseCommentsForResponse(response.getId()); } }