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;
 }
  /*
   * if questionnaire is associated with Amendment/renewal submodulecode.
   * if this protocol is normal protocol, then it has to check whether the A/R of this
   * questionnaire has merged to this protocol yet.
   */
  private boolean isCurrentAorRQn(AnswerHeader answerHeader) {
    boolean isCurrentQn = false;
    if (getProtocol().isAmendment() || getProtocol().isRenewal()) {
      // if this is A/R, then just match sequencenumber and modulesubitemkey
      isCurrentQn =
          answerHeader.getModuleSubItemKey().equals(getProtocol().getSequenceNumber().toString());
    } else {
      // if this is a regular protocol, then get this A/R associated this this Qn and see if
      // A/R has been merged to this version of protocol
      Map keyValues = new HashMap();
      keyValues.put("protocolNumber", answerHeader.getModuleItemKey());

      ProtocolBase protocol =
          ((List<ProtocolBase>)
                  getBusinessObjectService()
                      .findMatchingOrderBy(
                          getProtocolBOClassHook(), keyValues, "sequenceNumber", false))
              .get(0);

      isCurrentQn =
          answerHeader.getModuleSubItemKey().equals(protocol.getSequenceNumber().toString())
              && !CollectionUtils.isEmpty(protocol.getProtocolSubmissions())
              && isMergedToProtocol(getProtocol(), protocol);
    }
    return isCurrentQn;
  }
コード例 #3
0
 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;
 }