Example #1
0
  private Set<String> populateRecipientEmails(
      String courseId,
      List<StudentAttributes> allStudents,
      CourseRoster roster,
      Map<String, List<StudentAttributes>> teamStudentTable,
      Map<String, List<StudentAttributes>> sectionStudentTable)
      throws EntityDoesNotExistException {
    Set<String> recipientEmailsList = new HashSet<String>();

    List<CommentAttributes> sendingCommentsList =
        commentsDb.getCommentsForSendingState(courseId, CommentSendingState.SENDING);
    populateRecipientEmailsFromPendingComments(
        sendingCommentsList,
        allStudents,
        roster,
        teamStudentTable,
        sectionStudentTable,
        recipientEmailsList);

    List<FeedbackResponseCommentAttributes> sendingResponseCommentsList =
        frcLogic.getFeedbackResponseCommentsForSendingState(courseId, CommentSendingState.SENDING);
    populateRecipientEmailsFromPendingResponseComments(
        sendingResponseCommentsList, allStudents, roster, teamStudentTable, recipientEmailsList);

    return recipientEmailsList;
  }
Example #2
0
  /** ********** CRUD *********** */
  public CommentAttributes createComment(CommentAttributes comment)
      throws InvalidParametersException, EntityAlreadyExistsException, EntityDoesNotExistException {
    verifyIsCoursePresent(comment.courseId, "create");
    verifyIsInstructorOfCourse(comment.courseId, comment.giverEmail);

    return commentsDb.createEntity(comment);
  }
Example #3
0
 public List<CommentAttributes> getCommentsForReceiver(
     String courseId,
     String giverEmail,
     CommentParticipantType recipientType,
     String receiverEmail)
     throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   List<CommentAttributes> comments =
       commentsDb.getCommentsForReceiver(courseId, recipientType, receiverEmail);
   Iterator<CommentAttributes> iterator = comments.iterator();
   while (iterator.hasNext()) {
     CommentAttributes c = iterator.next();
     if (!c.giverEmail.equals(giverEmail)) {
       iterator.remove();
     }
   }
   return comments;
 }
Example #4
0
 public CommentSearchResultBundle searchComment(
     String queryString, List<InstructorAttributes> instructors, String cursorString) {
   return commentsDb.search(queryString, instructors, cursorString);
 }
Example #5
0
 /**
  * Create or update document for comment
  *
  * @param comment
  */
 public void putDocument(CommentAttributes comment) {
   commentsDb.putDocument(comment);
 }
Example #6
0
 public List<CommentAttributes> getCommentDrafts(String giverEmail) {
   return commentsDb.getCommentDrafts(giverEmail);
 }
Example #7
0
 public List<CommentAttributes> getCommentsForSendingState(
     String courseId, CommentSendingState sendingState) throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForSendingState(courseId, sendingState);
 }
Example #8
0
 public CommentAttributes getComment(Long commentId) {
   return commentsDb.getComment(commentId);
 }
Example #9
0
 public void deleteCommentsForTeam(String courseId, String teamName) {
   commentsDb.deleteCommentsForTeam(courseId, teamName);
 }
Example #10
0
 public void deleteCommentsForStudent(String courseId, String studentEmail) {
   commentsDb.deleteCommentsByStudentEmail(courseId, studentEmail);
 }
Example #11
0
 public void deleteCommentsForInstructor(String courseId, String instructorEmail) {
   commentsDb.deleteCommentsByInstructorEmail(courseId, instructorEmail);
 }
Example #12
0
 /**
  * update comment's recipient email (assume to be a student)
  *
  * @param courseId
  * @param oldStudentEmail
  * @param updatedStudentEmail
  */
 public void updateStudentEmail(
     String courseId, String oldStudentEmail, String updatedStudentEmail) {
   commentsDb.updateStudentEmail(courseId, oldStudentEmail, updatedStudentEmail);
 }
Example #13
0
 /**
  * update comment's giver email (assume to be an instructor)
  *
  * @param courseId
  * @param oldInstrEmail
  * @param updatedInstrEmail
  */
 public void updateInstructorEmail(
     String courseId, String oldInstrEmail, String updatedInstrEmail) {
   commentsDb.updateInstructorEmail(courseId, oldInstrEmail, updatedInstrEmail);
 }
Example #14
0
  public CommentAttributes updateComment(CommentAttributes comment)
      throws InvalidParametersException, EntityDoesNotExistException {
    verifyIsCoursePresent(comment.courseId, "update");

    return commentsDb.updateComment(comment);
  }
Example #15
0
 public void updateCommentsSendingState(
     String courseId, CommentSendingState oldState, CommentSendingState newState)
     throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "clear pending");
   commentsDb.updateComments(courseId, oldState, newState);
 }
Example #16
0
 private List<CommentAttributes> getCommentsForCommentViewer(
     String courseId, CommentParticipantType commentViewerType)
     throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForCommentViewer(courseId, commentViewerType);
 }
Example #17
0
 private List<CommentAttributes> getCommentsForGiverAndStatus(
     String courseId, String giverEmail, CommentStatus status) throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForGiverAndStatus(courseId, giverEmail, status);
 }
Example #18
0
 public void deleteCommentsForSection(String courseId, String sectionName) {
   commentsDb.deleteCommentsForSection(courseId, sectionName);
 }
Example #19
0
 public void deleteCommentsForCourse(String courseId) {
   commentsDb.deleteCommentsForCourse(courseId);
 }
Example #20
0
 public void deleteComment(CommentAttributes comment) {
   commentsDb.deleteEntity(comment);
 }
Example #21
0
 public List<CommentAttributes> getCommentsForGiver(String courseId, String giverEmail)
     throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForGiver(courseId, giverEmail);
 }
Example #22
0
 public void deleteDocument(CommentAttributes comment) {
   commentsDb.deleteDocument(comment);
 }
Example #23
0
 public List<CommentAttributes> getCommentsForReceiver(
     String courseId, CommentParticipantType recipientType, String receiverEmail)
     throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForReceiver(courseId, recipientType, receiverEmail);
 }
Example #24
0
 @SuppressWarnings("deprecation")
 public List<CommentAttributes> getAllComments() {
   return commentsDb.getAllComments();
 }