@Override
  public List<ProtocolOnlineReviewBase> getProtocolReviews(String protocolNumber) {
    ProtocolBase protocol = protocolFinderDao.findCurrentProtocolByNumber(protocolNumber);
    List<ProtocolOnlineReviewBase> reviews = null;

    if (protocol != null && protocol.getProtocolSubmission() != null) {
      reviews = protocol.getProtocolSubmission().getProtocolOnlineReviews();
    } else {
      reviews = new ArrayList<ProtocolOnlineReviewBase>();
    }

    return reviews;
  }
  @Override
  public List<CommitteeMembershipBase> getAvailableCommitteeMembersForCurrentSubmission(
      ProtocolBase protocol) {
    List<CommitteeMembershipBase> results = new ArrayList<CommitteeMembershipBase>();

    ProtocolSubmissionBase submission = protocol.getProtocolSubmission();
    submission.refreshReferenceObject("protocolOnlineReviews");
    if (LOG.isDebugEnabled()) {
      LOG.debug(
          String.format(
              "Fetching available committee members for protocol %s, submission %s",
              protocol.getProtocolNumber(), submission.getSubmissionNumber()));
    }

    List<ProtocolOnlineReviewBase> currentReviews = submission.getProtocolOnlineReviews();
    List<CommitteeMembershipBase> committeeMembers =
        getCommitteeService()
            .getAvailableMembers(submission.getCommitteeId(), submission.getScheduleId());
    // TODO: Make this better.
    for (CommitteeMembershipBase member : committeeMembers) {
      boolean found = false;
      for (ProtocolOnlineReviewBase review : currentReviews) {
        if (review.getProtocolReviewer().isProtocolReviewerFromCommitteeMembership(member)
            && review.isActive()) {
          found = true;
          break;
        }
      }
      if (!found && !isProtocolPersonnel(protocol, member)) {
        results.add(member);
      }
    }

    return results;
  }
 @Override
 public List<ProtocolOnlineReviewDocumentBase> getProtocolReviewDocumentsForCurrentSubmission(
     ProtocolBase protocol) {
   List<ProtocolOnlineReviewDocumentBase> onlineReviewDocuments =
       new ArrayList<ProtocolOnlineReviewDocumentBase>();
   ProtocolSubmissionBase submission = protocol.getProtocolSubmission();
   List<ProtocolOnlineReviewBase> reviews =
       findProtocolOnlineReviews(protocol.getProtocolId(), submission.getSubmissionId());
   for (ProtocolOnlineReviewBase review : reviews) {
     if (review.isActive()) {
       review.refresh();
       try {
         onlineReviewDocuments.add(
             (ProtocolOnlineReviewDocumentBase)
                 (documentService.getByDocumentHeaderId(
                     review.getProtocolOnlineReviewDocument().getDocumentNumber())));
       } catch (WorkflowException e) {
         throw new RuntimeException(
             String.format(
                 "Could not load ProtocolOnlineReviewBase docuemnt %s due to WorkflowException: %s",
                 review.getProtocolOnlineReviewDocument().getDocumentNumber(), e.getMessage()),
             e);
       }
     }
   }
   return onlineReviewDocuments;
 }
 @Override
 protected ProtocolActionBase getNewDisapprovedInRoutingProtocolActionInstanceHook(
     ProtocolBase protocol) {
   return new IacucProtocolAction(
       (IacucProtocol) protocol,
       (IacucProtocolSubmission) protocol.getProtocolSubmission(),
       IacucProtocolActionType.REJECTED_IN_ROUTING);
 }
  protected ProtocolDocument getReturnedVersionedDocument(ProtocolBase protocol) throws Exception {
    getDocumentService()
        .cancelDocument(
            protocol.getProtocolDocument(),
            "Protocol document cancelled - protocol has been returned for revisions.");
    getProtocolOnlineReviewService()
        .finalizeOnlineReviews(
            protocol.getProtocolSubmission(),
            "Protocol Review finalized - protocol has been returned for revisions.");

    return (ProtocolDocument) getVersionedDocument(protocol);
  }
 protected void performDisapprove(ProtocolBase protocol) throws Exception {
   if (protocol.getProtocolDocument() != null) {
     WorkflowDocument currentWorkflowDocument =
         protocol.getProtocolDocument().getDocumentHeader().getWorkflowDocument();
     if (currentWorkflowDocument != null) {
       currentWorkflowDocument.disapprove(
           "Protocol document disapproved after committee decision");
     }
   }
   getProtocolOnlineReviewService()
       .cancelOnlineReviews(
           protocol.getProtocolSubmission(),
           "Protocol Review cancelled - protocol has been disapproved.");
 }