Exemplo n.º 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;
  }
Exemplo n.º 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);
  }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 public CommentSearchResultBundle searchComment(
     String queryString, List<InstructorAttributes> instructors, String cursorString) {
   return commentsDb.search(queryString, instructors, cursorString);
 }
Exemplo n.º 5
0
 /**
  * Create or update document for comment
  *
  * @param comment
  */
 public void putDocument(CommentAttributes comment) {
   commentsDb.putDocument(comment);
 }
Exemplo n.º 6
0
 public List<CommentAttributes> getCommentDrafts(String giverEmail) {
   return commentsDb.getCommentDrafts(giverEmail);
 }
Exemplo n.º 7
0
 public List<CommentAttributes> getCommentsForSendingState(
     String courseId, CommentSendingState sendingState) throws EntityDoesNotExistException {
   verifyIsCoursePresent(courseId, "get");
   return commentsDb.getCommentsForSendingState(courseId, sendingState);
 }
Exemplo n.º 8
0
 public CommentAttributes getComment(Long commentId) {
   return commentsDb.getComment(commentId);
 }
Exemplo n.º 9
0
 public void deleteCommentsForTeam(String courseId, String teamName) {
   commentsDb.deleteCommentsForTeam(courseId, teamName);
 }
Exemplo n.º 10
0
 public void deleteCommentsForStudent(String courseId, String studentEmail) {
   commentsDb.deleteCommentsByStudentEmail(courseId, studentEmail);
 }
Exemplo n.º 11
0
 public void deleteCommentsForInstructor(String courseId, String instructorEmail) {
   commentsDb.deleteCommentsByInstructorEmail(courseId, instructorEmail);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 14
0
  public CommentAttributes updateComment(CommentAttributes comment)
      throws InvalidParametersException, EntityDoesNotExistException {
    verifyIsCoursePresent(comment.courseId, "update");

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