/**
  * Find the submission. It is the submission that is either currently pending or already submitted
  * to a committee.
  *
  * @param protocol
  * @return
  */
 private ProtocolSubmission findSubmission(Protocol protocol) {
   for (ProtocolSubmission submission : protocol.getProtocolSubmissions()) {
     if (StringUtils.equals(submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.PENDING)
         || StringUtils.equals(
             submission.getSubmissionStatusCode(),
             ProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)) {
       return submission;
     }
   }
   return null;
 }
 @Override
 public boolean isProtocolInStateToBeReviewed(ProtocolBase protocol) {
   boolean isReviewable = false;
   ProtocolSubmission submission =
       (ProtocolSubmission) ((Protocol) protocol).getProtocolSubmission();
   if (submission != null) {
     try {
       isReviewable =
           StringUtils.isNotEmpty(submission.getScheduleId())
               || ProtocolReviewType.EXPEDITED_REVIEW_TYPE_CODE.equals(
                   submission.getProtocolReviewTypeCode())
               || (ProtocolReviewType.FYI_TYPE_CODE.equalsIgnoreCase(
                       submission.getProtocolReviewTypeCode())
                   && ProtocolSubmissionType.NOTIFY_IRB.equalsIgnoreCase(
                       submission.getProtocolSubmissionType().getSubmissionTypeCode()));
       isReviewable &=
           (StringUtils.equals(
                   submission.getSubmissionStatusCode(),
                   ProtocolSubmissionStatus.SUBMITTED_TO_COMMITTEE)
               || StringUtils.equals(
                   submission.getSubmissionStatusCode(), ProtocolSubmissionStatus.IN_AGENDA));
       ProtocolDocument protocolDocument =
           (ProtocolDocument)
               protocol
                   .getProtocolDocument(); // (ProtocolDocument)
                                           // documentService.getByDocumentHeaderId(protocol.getProtocolDocument().getDocumentNumber());
       isReviewable &=
           getKraWorkflowService()
               .isCurrentNode(protocolDocument, Constants.PROTOCOL_IRBREVIEW_ROUTE_NODE_NAME);
     } catch (Exception e) {
       String errorString =
           String.format(
               "WorkflowException checking route node for creating new ProtocolOnlineReviewDocument "
                   + "for protocol %s",
               submission.getProtocolNumber());
       LOG.error(errorString, e);
       throw new RuntimeException(errorString, e);
     }
   }
   return isReviewable;
 }