@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;
 }
 /*
  * this returns a list of submission numbers for a protocol.
  */
 private List<Integer> getAvailableSubmissionNumbers() {
   List<Integer> submissionNumbers = new ArrayList<Integer>();
   for (ProtocolSubmissionBase submission : getProtocol().getProtocolSubmissions()) {
     submissionNumbers.add(submission.getSubmissionNumber());
   }
   return submissionNumbers;
 }
  @Override
  public ProtocolOnlineReviewDocumentBase createAndRouteProtocolOnlineReviewDocument(
      ProtocolSubmissionBase protocolSubmission,
      ProtocolReviewer protocolReviewer,
      String documentDescription,
      String documentExplanation,
      String documentOrganizationDocumentNumber,
      String documentRouteAnnotation,
      boolean initialApproval,
      Date dateRequested,
      Date dateDue,
      String principalId) {

    ProtocolOnlineReviewDocumentBase document = null;

    try {
      if (LOG.isDebugEnabled()) {
        String protocolNumber = protocolSubmission.getProtocolNumber();
        Integer submissionNumber = protocolSubmission.getSubmissionNumber();
        LOG.debug(
            String.format(
                "Assigning online reviewer [%s] to protocol [%s].",
                protocolReviewer, protocolNumber));
        LOG.debug(
            String.format(
                "Current submission for protocol %s is %s.", protocolNumber, submissionNumber));
      }

      document =
          createProtocolOnlineReviewDocument(
              protocolSubmission,
              protocolReviewer,
              documentDescription,
              documentExplanation,
              documentOrganizationDocumentNumber,
              dateRequested,
              dateDue,
              principalId);

      documentService.routeDocument(
          document,
          "Review Requested by PI during protocol submission.",
          new ArrayList<AdHocRouteRecipient>());

      if (initialApproval) {
        documentService.approveDocument(document, "", new ArrayList<AdHocRouteRecipient>());
      }
    } catch (WorkflowException e) {
      String errorString =
          String.format(
              "WorkflowException creating new ProtocolOnlineReviewDocumentBase for reviewer %s, protocol %s",
              protocolReviewer.getPersonId(), protocolSubmission.getProtocolNumber());
      LOG.error(errorString, e);
      throw new RuntimeException(errorString, e);
    }

    return document;
  }
 /*
  * create the view link url for protocolsubmission
  */
 protected AnchorHtmlData getViewLink(ProtocolSubmissionBase protocolSubmission) {
   AnchorHtmlData viewHtmlData =
       super.getViewLink(protocolSubmission.getProtocol().getProtocolDocument());
   String submissionIdParam = "&submissionId=" + protocolSubmission.getSubmissionId();
   String href = viewHtmlData.getHref();
   href = href.replace(DOC_TYPE_NAME_PARAM, submissionIdParam + DOC_TYPE_NAME_PARAM);
   viewHtmlData.setHref(href);
   return viewHtmlData;
 }
  public ProtocolOnlineReviewDocumentBase createProtocolOnlineReviewDocument(
      ProtocolSubmissionBase protocolSubmission,
      ProtocolReviewer protocolReviewer,
      String documentDescription,
      String documentExplanation,
      String documentOrganizationDocumentNumber,
      Date dateRequested,
      Date dateDue,
      String principalId)
      throws WorkflowException {

    IacucProtocolOnlineReviewDocument protocolReviewDocument;

    Person person = personService.getPerson(principalId);
    WorkflowDocument workflowDocument =
        workflowDocumentService.createWorkflowDocument(
            IACUC_PROTOCOL_ONLINE_REVIEW_DOCUMENT_TYPE, person);

    DocumentHeader docHeader = new DocumentHeader();
    docHeader.setWorkflowDocument(workflowDocument);
    docHeader.setDocumentNumber(workflowDocument.getDocumentId().toString());
    protocolReviewDocument = new IacucProtocolOnlineReviewDocument();
    protocolReviewDocument.setDocumentNumber(docHeader.getDocumentNumber());
    protocolReviewDocument.setDocumentHeader(docHeader);

    protocolReviewDocument.getProtocolOnlineReview().setProtocol(protocolSubmission.getProtocol());

    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolId(protocolSubmission.getProtocolId());

    protocolReviewDocument.getProtocolOnlineReview().setProtocolSubmission(protocolSubmission);
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setSubmissionIdFk(protocolSubmission.getSubmissionId());
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolOnlineReviewStatusCode(IacucProtocolOnlineReviewStatus.SAVED_STATUS_CD);
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setDateRequested(
            dateRequested == null ? new Date((new java.util.Date()).getTime()) : dateRequested);
    protocolReviewDocument.getProtocolOnlineReview().setDateDue(dateDue);

    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolReviewerId(protocolReviewer.getProtocolReviewerId());
    protocolReviewDocument.getProtocolOnlineReview().setProtocolReviewer(protocolReviewer);

    docHeader.setDocumentDescription(documentDescription);
    docHeader.setOrganizationDocumentNumber(documentOrganizationDocumentNumber);
    docHeader.setExplanation(documentExplanation);

    documentService.saveDocument(protocolReviewDocument);
    return protocolReviewDocument;
  }
  /**
   * Creates a new ProtocolReviewDocument.
   *
   * <p>Handles creating the workflow document, and the underlying ProtocolReview BO linking the
   * protocol, submission, and reviewer.
   *
   * @param protocolSubmission The protocol submission
   * @param protocolReviewerBean The bean that holds
   * @param documentDescription the description for the created document
   * @param documentExplanation the explanation for the created document
   * @param documentOrganizationNumber the organizationNumber for the created document
   * @param principalId The principalId to use when creating the workflow document. Usually this
   *     should be the principal of the user creating the review.
   * @return
   * @throws WorkflowException
   */
  protected ProtocolOnlineReviewDocumentBase createProtocolOnlineReviewDocument(
      ProtocolSubmissionBase protocolSubmission,
      ProtocolReviewer protocolReviewer,
      String documentDescription,
      String documentExplanation,
      String documentOrganizationDocumentNumber,
      Date dateRequested,
      Date dateDue,
      String principalId)
      throws WorkflowException {

    ProtocolOnlineReviewDocumentBase protocolReviewDocument;

    Person person = personService.getPerson(principalId);
    WorkflowDocument workflowDocument =
        workflowDocumentService.createWorkflowDocument(getProtocolOLRDocumentTypeHook(), person);

    DocumentHeader docHeader = new DocumentHeader();
    docHeader.setWorkflowDocument(workflowDocument);
    docHeader.setDocumentNumber(workflowDocument.getDocumentId().toString());
    protocolReviewDocument = getNewProtocolOnlineReviewDocumentInstanceHook();
    protocolReviewDocument.setDocumentNumber(docHeader.getDocumentNumber());
    protocolReviewDocument.setDocumentHeader(docHeader);

    protocolReviewDocument.getProtocolOnlineReview().setProtocol(protocolSubmission.getProtocol());

    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolId(protocolSubmission.getProtocolId());

    protocolReviewDocument.getProtocolOnlineReview().setProtocolSubmission(protocolSubmission);
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setSubmissionIdFk(protocolSubmission.getSubmissionId());
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolOnlineReviewStatusCode(getProtocolOLRSavedStatusCodeHook());
    protocolReviewDocument
        .getProtocolOnlineReview()
        .setDateRequested(
            dateRequested == null ? new Date((new java.util.Date()).getTime()) : dateRequested);
    protocolReviewDocument.getProtocolOnlineReview().setDateDue(dateDue);

    protocolReviewDocument
        .getProtocolOnlineReview()
        .setProtocolReviewerId(protocolReviewer.getProtocolReviewerId());
    protocolReviewDocument.getProtocolOnlineReview().setProtocolReviewer(protocolReviewer);

    docHeader.setDocumentDescription(documentDescription);
    docHeader.setOrganizationDocumentNumber(documentOrganizationDocumentNumber);
    docHeader.setExplanation(documentExplanation);

    documentService.saveDocument(protocolReviewDocument);
    return protocolReviewDocument;
  }
 private boolean isMergedToProtocol(ProtocolBase protocol, ProtocolBase amendment) {
   boolean merged = false;
   int submissionNumber =
       amendment
           .getProtocolSubmissions()
           .get(amendment.getProtocolSubmissions().size() - 1)
           .getSubmissionNumber();
   for (ProtocolSubmissionBase submission : protocol.getProtocolSubmissions()) {
     if (submissionNumber == submission.getSubmissionNumber().intValue()) {
       merged = true;
       break;
     }
   }
   return merged;
 }
 @Override
 public void cancelOnlineReviews(ProtocolSubmissionBase submission, String annotation) {
   // get the online reviews, loop through them and finalize them if necessary.
   for (ProtocolOnlineReviewBase review : submission.getProtocolOnlineReviews()) {
     cancelOnlineReviewDocument(review.getProtocolOnlineReviewDocument(), submission, annotation);
   }
 }
 protected boolean isRequestForSuspension(
     ProtocolSubmissionBase submission, String submissionType) {
   if (submission != null && submissionType.equals(submission.getSubmissionTypeCode())) {
     return true;
   }
   return false;
 }
  protected void removeOnlineReviewDocument(
      ProtocolOnlineReviewDocumentBase protocolOnlineReviewDocument,
      ProtocolSubmissionBase submission,
      String annotation) {

    if (protocolOnlineReviewDocument != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(
            String.format(
                "Found protocolOnlineReviewDocument %s, removing it.",
                protocolOnlineReviewDocument.getDocumentNumber()));
      }
      cancelOnlineReviewDocument(protocolOnlineReviewDocument, submission, annotation);
      protocolOnlineReviewDocument
          .getProtocolOnlineReview()
          .setProtocolOnlineReviewStatusCode(
              ProtocolOnlineReviewStatus.REMOVED_CANCELLED_STATUS_CD);

      List<CommitteeScheduleMinuteBase> reviewComments =
          protocolOnlineReviewDocument.getProtocolOnlineReview().getCommitteeScheduleMinutes();
      List<CommitteeScheduleMinuteBase> deletedReviewComments =
          new ArrayList<CommitteeScheduleMinuteBase>();
      getReviewerCommentsService().deleteAllReviewComments(reviewComments, deletedReviewComments);
      getReviewerCommentsService().saveReviewComments(reviewComments, deletedReviewComments);

      submission
          .getProtocolReviewers()
          .remove(protocolOnlineReviewDocument.getProtocolOnlineReview().getProtocolReviewer());
      getBusinessObjectService().save(protocolOnlineReviewDocument.getProtocolOnlineReview());
    }
  }
  @Override
  public List<ProtocolOnlineReviewBase> getProtocolReviews(Long submissionId) {
    List<ProtocolOnlineReviewBase> reviews = new ArrayList<ProtocolOnlineReviewBase>();

    ProtocolSubmissionBase submission =
        getBusinessObjectService()
            .findBySinglePrimaryKey(getProtocolSubmissionBOClassHook(), submissionId);
    if (submission != null) {
      for (ProtocolOnlineReviewBase review : submission.getProtocolOnlineReviews()) {
        if (review.isActive()) {
          reviews.add(review);
        }
      }
    }

    return reviews;
  }
 protected ProtocolSubmission getSubmission(ProtocolBase protocol) {
   // There are 'findCommission' in other classes.  Consider to create a utility static method for
   // this
   // need to loop thru to find the last submission.
   // it may have submit/Wd/notify irb/submit, and this will cause problem if don't loop thru.
   ProtocolSubmission protocolSubmission = null;
   for (ProtocolSubmissionBase submission : protocol.getProtocolSubmissions()) {
     if (StringUtils.equals(
             submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.IN_AGENDA)
         || StringUtils.equals(
             submission.getSubmissionStatusCode(),
             ProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)) {
       protocolSubmission = (ProtocolSubmission) submission;
     }
   }
   return protocolSubmission;
 }
 @Override
 public void finalizeOnlineReviews(ProtocolSubmissionBase submission, String annotation) {
   // get the online reviews, loop through them and finalize them if necessary.
   for (ProtocolOnlineReviewBase review : submission.getProtocolOnlineReviews()) {
     //
     // review.addActionPerformed("Finalize:"+review.getProtocolOnlineReviewDocument().getDocumentHeader().getWorkflowDocument().getStatus().getCode()+":"+review.getProtocolOnlineReviewStatusCode());
     finalizeOnlineReviewDocument(
         review.getProtocolOnlineReviewDocument(), submission, annotation);
   }
 }
  private void performGenericAction(
      Protocol protocol, ProtocolGenericActionBean actionBean, String protocolActionType)
      throws Exception {
    ProtocolAction protocolAction =
        (ProtocolAction) createProtocolActionAndAttach(protocol, actionBean, protocolActionType);

    if (protocol.getNotifyIrbSubmissionId() == null) {
      getProtocolActionService().updateProtocolStatus(protocolAction, protocol);
    } else {
      for (ProtocolSubmissionBase submission : protocol.getProtocolSubmissions()) {
        if (submission.getSubmissionId().equals(protocol.getNotifyIrbSubmissionId())) {
          submission.setSubmissionStatusCode(ProtocolSubmissionStatus.IRB_ACKNOWLEDGEMENT);
        }
      }
    }

    protocol.refreshReferenceObject("protocolStatus");
    protocol.refreshReferenceObject("protocolSubmission");
    getDocumentService().saveDocument(protocol.getProtocolDocument());
  }
  @Override
  public ProtocolOnlineReviewDocumentBase getProtocolOnlineReviewDocument(
      String personId, boolean nonEmployeeFlag, ProtocolSubmissionBase protocolSubmission) {
    ProtocolOnlineReviewDocumentBase protocolOnlineReviewDocument = null;

    if (protocolSubmission != null) {
      for (ProtocolOnlineReviewBase protocolOnlineReview :
          protocolSubmission.getProtocolOnlineReviews()) {
        if (protocolOnlineReview
                .getProtocolReviewer()
                .isPersonIdProtocolReviewer(personId, nonEmployeeFlag)
            && protocolOnlineReview.isActive()) {
          try {
            protocolOnlineReviewDocument =
                (ProtocolOnlineReviewDocumentBase)
                    getDocumentService()
                        .getByDocumentHeaderId(
                            protocolOnlineReview
                                .getProtocolOnlineReviewDocument()
                                .getDocumentNumber());
          } catch (WorkflowException e) {
            if (LOG.isDebugEnabled()) {
              String errorMessage =
                  String.format(
                      "WorkflowException encountered while looking up document number %s for ProtocolOnlineReviewDocumentBase associated with (submissionId=%s,personId=%s,nonEmployeeFlag=%s",
                      protocolOnlineReview.getProtocolOnlineReviewDocument().getDocumentNumber(),
                      protocolSubmission.getSubmissionId(),
                      personId,
                      nonEmployeeFlag);

              LOG.error(errorMessage, e);
              throw new RuntimeException(errorMessage, e);
            }
          }
        }
      }
    }

    return protocolOnlineReviewDocument;
  }
  @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 ProtocolReviewer createProtocolReviewer(
      String principalId,
      boolean nonEmployeeFlag,
      String reviewerTypeCode,
      ProtocolSubmissionBase protocolSubmission) {
    ProtocolReviewer reviewer = createNewProtocolReviewerInstanceHook();
    reviewer.setProtocolIdFk(protocolSubmission.getProtocolId());
    reviewer.setSubmissionIdFk(protocolSubmission.getSubmissionId());
    reviewer.setProtocolNumber(protocolSubmission.getProtocolNumber());
    reviewer.setSequenceNumber(protocolSubmission.getSequenceNumber());
    reviewer.setSubmissionNumber(protocolSubmission.getSubmissionNumber());
    if (!nonEmployeeFlag) {
      reviewer.setPersonId(principalId);
    } else {
      reviewer.setRolodexId(Integer.parseInt(principalId));
    }
    reviewer.setNonEmployeeFlag(nonEmployeeFlag);
    reviewer.setReviewerTypeCode(reviewerTypeCode);

    businessObjectService.save(reviewer);

    return reviewer;
  }
  @Override
  public boolean isProtocolReviewer(
      String personId, boolean nonEmployeeFlag, ProtocolSubmissionBase protocolSubmission) {
    boolean isReviewer = false;

    if (protocolSubmission != null) {
      for (ProtocolOnlineReviewBase review : protocolSubmission.getProtocolOnlineReviews()) {
        if (review.getProtocolReviewer().isPersonIdProtocolReviewer(personId, nonEmployeeFlag)
            && review.isActive()) {
          isReviewer = true;
          break;
        }
      }
    }

    return isReviewer;
  }
 @Override
 public void moveOnlineReviews(
     ProtocolSubmissionBase submission, ProtocolSubmissionBase newSubmission) {
   newSubmission.setProtocolOnlineReviews(new ArrayList<ProtocolOnlineReviewBase>());
   for (ProtocolOnlineReviewBase review : submission.getProtocolOnlineReviews()) {
     review.setProtocol(newSubmission.getProtocol());
     review.setProtocolId(newSubmission.getProtocol().getProtocolId());
     review.setSubmissionIdFk(newSubmission.getSubmissionId());
     if (CollectionUtils.isNotEmpty(review.getCommitteeScheduleMinutes())) {
       for (CommitteeScheduleMinuteBase comment : review.getCommitteeScheduleMinutes()) {
         comment.setProtocolIdFk(review.getProtocolId());
         comment.setScheduleIdFk(newSubmission.getScheduleIdFk());
       }
     }
     newSubmission.getProtocolOnlineReviews().add(review);
   }
 }
  @Override
  public ProtocolReviewer getProtocolReviewer(
      String personId, boolean nonEmployeeFlag, ProtocolSubmissionBase protocolSubmission) {
    ProtocolReviewer protocolReviewer = null;

    if (protocolSubmission != null) {
      for (ProtocolOnlineReviewBase protocolOnlineReview :
          protocolSubmission.getProtocolOnlineReviews()) {
        if (protocolOnlineReview
                .getProtocolReviewer()
                .isPersonIdProtocolReviewer(personId, nonEmployeeFlag)
            && protocolOnlineReview.isActive()) {
          protocolReviewer = protocolOnlineReview.getProtocolReviewer();
          break;
        }
      }
    }

    return protocolReviewer;
  }
  public boolean isProtocolInStateToBeReviewed(ProtocolBase protocol) {
    boolean isReviewable = false;
    ProtocolSubmissionBase submission =
        (IacucProtocolSubmission) ((IacucProtocol) protocol).getProtocolSubmission();

    if (submission != null) {
      try {
        isReviewable =
            StringUtils.isNotEmpty(submission.getScheduleId())
                || StringUtils.equals(
                    submission.getProtocolSubmissionType().getSubmissionTypeCode(),
                    IacucProtocolSubmissionType.NOTIFY_IACUC);
        isReviewable &=
            (StringUtils.equals(
                    submission.getSubmissionStatusCode(),
                    IacucProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)
                || StringUtils.equals(
                    submission.getSubmissionStatusCode(), IacucProtocolSubmissionStatus.IN_AGENDA));
        ProtocolDocumentBase protocolDocument =
            (ProtocolDocumentBase)
                documentService.getByDocumentHeaderId(
                    protocol.getProtocolDocument().getDocumentNumber());
        isReviewable &=
            kraWorkflowService.isCurrentNode(
                protocolDocument, Constants.IACUC_PROTOCOL_IACUCREVIEW_ROUTE_NODE_NAME);
      } catch (WorkflowException e) {
        String errorString =
            String.format(
                "WorkflowException checking route node for creating new ProtocolOnlineReviewDocumentBase "
                    + "for protocol %s",
                submission.getProtocolNumber());
        LOG.error(errorString, e);
        throw new RuntimeException(errorString, e);
      }
    }
    return isReviewable;
  }
 /**
  * Is the protocol's submission in a pending or submitted to committee status?
  *
  * @param protocol
  * @return
  */
 private boolean isAssignedToCommittee(ProtocolBase protocol) {
   ProtocolSubmissionBase ps = findSubmission(protocol);
   return ps != null
       && ps.getCommitteeSchedule() != null
       && ps.getCommitteeSchedule().getScheduledDate() != null;
 }
  @Override
  public void removeOnlineReviewDocument(
      String personId,
      boolean nonEmployeeFlag,
      ProtocolSubmissionBase submission,
      String annotation) {
    ProtocolOnlineReviewDocumentBase protocolOnlineReviewDocument =
        this.getProtocolOnlineReviewDocument(personId, nonEmployeeFlag, submission);

    ProtocolOnlineReviewBase submissionsProtocolOnlineReview = null;
    for (ProtocolOnlineReviewBase rev : submission.getProtocolOnlineReviews()) {
      if (rev.getProtocolOnlineReviewId()
          .equals(
              protocolOnlineReviewDocument.getProtocolOnlineReview().getProtocolOnlineReviewId())) {
        submissionsProtocolOnlineReview = rev;
        break;
      }
    }

    if (submissionsProtocolOnlineReview == null) {
      throw new IllegalStateException(
          "Could not match OnlineReview document being removed to a protocolOnlineReview in the submission.");
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug(
          String.format(
              "Processing request to remove online review for (personId=%s,nonEmployeeFlag=%s) from (protocol=%s,submission=%s)",
              personId,
              nonEmployeeFlag,
              submission.getProtocol().getProtocolNumber(),
              submission.getSubmissionNumber()));
    }

    if (protocolOnlineReviewDocument != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug(
            String.format(
                "Found protocolOnlineReviewDocument %s, removing it.",
                protocolOnlineReviewDocument.getDocumentNumber()));
      }
      cancelOnlineReviewDocument(protocolOnlineReviewDocument, submission, annotation);
      submissionsProtocolOnlineReview.setProtocolOnlineReviewStatusCode(
          getProtocolOLRRemovedCancelledStatusCodeHook());

      List<CommitteeScheduleMinuteBase> reviewComments =
          protocolOnlineReviewDocument.getProtocolOnlineReview().getCommitteeScheduleMinutes();
      List<CommitteeScheduleMinuteBase> deletedReviewComments =
          new ArrayList<CommitteeScheduleMinuteBase>();
      getReviewerCommentsService().deleteAllReviewComments(reviewComments, deletedReviewComments);
      getReviewerCommentsService().saveReviewComments(reviewComments, deletedReviewComments);

      getBusinessObjectService().save(submissionsProtocolOnlineReview);

    } else {
      LOG.warn(
          String.format(
              "ProtocolBase Online Review document could not be found for (personId=%s,nonEmployeeFlag=%s) from (protocol=%s,submission=%s)",
              personId,
              nonEmployeeFlag,
              submission.getProtocol().getProtocolNumber(),
              submission.getSubmissionNumber()));
    }
  }