/**
  * 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;
 }
Example #2
0
  private boolean canPerform(ProtocolAction lastAction, ProtocolSubmission lastSubmission) {
    boolean canPerform = false;

    if (lastAction != null && lastSubmission != null) {

      boolean traditionalSubPerform =
          ProtocolActionType.RECORD_COMMITTEE_DECISION.equals(
                  lastAction.getProtocolActionTypeCode())
              && CommitteeDecisionMotionType.SPECIFIC_MINOR_REVISIONS.equals(
                  lastSubmission.getCommitteeDecisionMotionTypeCode());

      boolean exemptExpeditePerform = false;
      if (lastSubmission.getProtocolReviewType() != null) {
        exemptExpeditePerform =
            isExpeditedOrExempt(lastSubmission.getProtocolReviewType().getReviewTypeCode())
                && ProtocolActionType.SUBMIT_TO_IRB.equals(lastAction.getProtocolActionTypeCode());
      }

      canPerform = traditionalSubPerform || exemptExpeditePerform;
    }

    return canPerform;
  }
 @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;
 }
  @Test
  public void testProcessApproveCommitteeDecision() throws Exception {
    Protocol protocol = getProtocolAssignedToAgenda();

    CommitteeDecision committeeDecision =
        getMockCommitteeDecisionBean(CommitteeDecisionMotionType.APPROVE);
    service.processCommitteeDecision(protocol, committeeDecision);

    ProtocolAction lastAction = protocol.getLastProtocolAction();
    assertNotNull(lastAction);
    assertEquals(
        ProtocolActionType.RECORD_COMMITTEE_DECISION, lastAction.getProtocolActionTypeCode());
    ProtocolSubmission submission = protocol.getProtocolSubmission();
    assertNotNull(submission);
    assertEquals(
        CommitteeDecisionMotionType.APPROVE, submission.getCommitteeDecisionMotionTypeCode());
    assertEquals(YES_COUNT, submission.getYesVoteCount());
    assertEquals(NO_COUNT, submission.getNoVoteCount());
    assertEquals(ABSTAIN_COUNT, submission.getAbstainerCount());
    assertEquals(RECUSED_COUNT, submission.getRecusedCount());
    assertEquals(VOTING_COMMENTS, submission.getVotingComments());
  }
 /**
  * Is the submission assigned to a committee and schedule?
  *
  * @param protocol
  * @return
  */
 private boolean isInSchedule(Protocol protocol) {
   ProtocolSubmission submission = findSubmission(protocol);
   return submission != null
       && !StringUtils.isBlank(submission.getCommitteeId())
       && !StringUtils.isBlank(submission.getScheduleId());
 }