protected void setReferencesForProtocolCorrespondence(ProtocolDocument newDocument) {
   Protocol newProtocol = newDocument.getProtocol();
   newProtocol
       .getProtocolActions()
       .forEach(
           protocolAction -> {
             protocolAction.setSequenceNumber(newProtocol.getSequenceNumber());
             protocolAction
                 .getProtocolCorrespondences()
                 .forEach(
                     protocolCorrespondence -> {
                       protocolCorrespondence.setProtocolId(newProtocol.getProtocolId());
                       protocolCorrespondence.setSequenceNumber(newProtocol.getSequenceNumber());
                     });
           });
 }
  @Test
  public void testGetProtocolVersion() throws Exception {
    Protocol protocol = (Protocol) protocolVersionService.getProtocolVersion(PROTOCOL_NUMBER, 1);
    assertNull(protocol);

    ProtocolDocument protocolDocument1 = ProtocolFactory.createProtocolDocument(PROTOCOL_NUMBER);
    ProtocolDocument protocolDocument2 =
        (ProtocolDocument) protocolVersionService.versionProtocolDocument(protocolDocument1);
    ProtocolDocument protocolDocument3 =
        (ProtocolDocument) protocolVersionService.versionProtocolDocument(protocolDocument2);

    protocol = (Protocol) protocolVersionService.getProtocolVersion(PROTOCOL_NUMBER, 2);
    assertNotNull(protocol);
    assertEquals(new Integer(2), protocol.getSequenceNumber());
  }
示例#3
0
  public Schedule getSchedule(CommitteeSchedule committeeSchedule) {
    Schedule schedule = Schedule.Factory.newInstance();
    setScheduleMasterData(committeeSchedule, schedule.addNewScheduleMasterData());
    PreviousSchedule prevSchedule = schedule.addNewPreviousSchedule();
    setPreviousSchedule(committeeSchedule, prevSchedule.addNewScheduleMasterData());
    NextSchedule nextScheduleType = schedule.addNewNextSchedule();
    setNextSchedule(committeeSchedule, nextScheduleType.addNewScheduleMasterData());

    getIrbPrintXmlUtilService().setMinutes(committeeSchedule, schedule);
    setAttendance(committeeSchedule, schedule);
    committeeSchedule.refreshReferenceObject("protocolSubmissions");
    List<org.kuali.kra.irb.actions.submit.ProtocolSubmissionLite> submissions =
        committeeSchedule.getLatestProtocolSubmissions();
    for (org.kuali.kra.irb.actions.submit.ProtocolSubmissionLite protocolSubmission : submissions) {

      ProtocolSubmission protocolSubmissionType = schedule.addNewProtocolSubmission();
      SubmissionDetails protocolSubmissionDetail = protocolSubmissionType.addNewSubmissionDetails();
      ProtocolSummary protocolSummary = protocolSubmissionType.addNewProtocolSummary();
      ProtocolMasterData protocolMaster = protocolSummary.addNewProtocolMasterData();
      String followUpAction = null;
      String actionTypeCode = null;
      Protocol protocol =
          getBusinessObjectService()
              .findByPrimaryKey(
                  Protocol.class,
                  Collections.singletonMap("protocolId", protocolSubmission.getProtocolId()));
      List<ProtocolActionBase> protocolActions = protocol.getProtocolActions();

      for (ProtocolActionBase protocolAction : protocolActions) {
        actionTypeCode = protocolAction.getProtocolActionTypeCode();
        if (actionTypeCode.equals(EXPEDIT_ACTION_TYPE_CODE)
            || actionTypeCode.equals(EXEMPT_ACTION_TYPE_CODE)) {
          if (protocolAction.getFollowupActionCode() != null
              && protocolAction.getFollowupActionCode().equals(FOLLOW_UP_ACTION_CODE)) {
            followUpAction = protocolAction.getFollowupActionCode();
          }
          break;
        }
      }

      protocolMaster.setProtocolNumber(protocol.getProtocolNumber());
      protocolMaster.setSequenceNumber(
          new BigInteger(String.valueOf(protocol.getSequenceNumber())));
      protocolMaster.setProtocolTitle(protocol.getTitle());
      protocolMaster.setProtocolStatusCode(
          new BigInteger(String.valueOf(protocol.getProtocolStatusCode())));
      protocolMaster.setProtocolStatusDesc(protocol.getProtocolStatus().getDescription());
      protocolMaster.setProtocolTypeCode(
          new BigInteger(String.valueOf(protocol.getProtocolTypeCode())));
      protocolMaster.setProtocolTypeDesc(protocol.getProtocolType().getDescription());

      if (protocol.getDescription() != null) {
        protocolMaster.setProtocolDescription(protocol.getDescription());
      }

      if (protocol.getApprovalDate() != null) {
        protocolMaster.setApprovalDate(
            getDateTimeService().getCalendar(protocol.getApprovalDate()));
      }

      if (protocol.getExpirationDate() != null) {
        protocolMaster.setExpirationDate(
            getDateTimeService().getCalendar(protocol.getExpirationDate()));
      }

      if (protocol.getFdaApplicationNumber() != null) {
        protocolMaster.setFdaApplicationNumber(protocol.getFdaApplicationNumber());
      }

      if (protocol.getReferenceNumber1() != null) {
        protocolMaster.setRefNumber1(protocol.getReferenceNumber1());
      }

      if (protocol.getReferenceNumber2() != null) {
        protocolMaster.setRefNumber2(protocol.getReferenceNumber2());
      }

      protocolSubmissionDetail.setProtocolNumber(protocolSubmission.getProtocolNumber());
      if (protocolSubmission.getProtocolSubmissionType() != null) {
        protocolSubmissionDetail.setSubmissionTypeDesc(
            protocolSubmission.getProtocolSubmissionType().getDescription());
      }

      if (protocolSubmission.getProtocolReviewTypeCode() != null) {
        protocolSubmissionDetail.setProtocolReviewTypeCode(
            new BigInteger(protocolSubmission.getProtocolReviewTypeCode()));
      }
      if (protocolSubmission.getProtocolReviewType() != null) {
        protocolSubmissionDetail.setProtocolReviewTypeDesc(
            protocolSubmission.getProtocolReviewType().getDescription());
      }
      if (protocolSubmission.getSubmissionTypeCode() != null) {
        protocolSubmissionDetail.setSubmissionTypeCode(
            new BigInteger(String.valueOf(protocolSubmission.getSubmissionTypeCode())));
      }
      if (protocolSubmission.getProtocolSubmissionType() != null) {
        protocolSubmissionDetail.setSubmissionTypeDesc(
            protocolSubmission.getProtocolSubmissionType().getDescription());
      }
      if (protocolSubmission.getSubmissionNumber() != null) {
        protocolSubmissionDetail.setSubmissionNumber(
            new BigInteger(String.valueOf(protocolSubmission.getSubmissionNumber())));
      }
      if (protocolSubmission.getSubmissionStatusCode() != null) {
        protocolSubmissionDetail.setSubmissionStatusCode(
            new BigInteger(String.valueOf(protocolSubmission.getSubmissionStatusCode())));
      }
      if (protocolSubmission.getSubmissionStatus() != null) {
        protocolSubmissionDetail.setSubmissionStatusDesc(
            protocolSubmission.getSubmissionStatus().getDescription());
      }
      if (protocolSubmission.getSubmissionTypeQualifierCode() != null) {
        protocolSubmissionDetail.setSubmissionTypeQualifierCode(
            new BigInteger(protocolSubmission.getSubmissionTypeQualifierCode()));
      }
      if (protocolSubmission.getProtocolSubmissionQualifierType() != null) {
        protocolSubmissionDetail.setSubmissionTypeQualifierDesc(
            protocolSubmission.getProtocolSubmissionQualifierType().getDescription());
      }
      if (protocolSubmission.getYesVoteCount() != null) {
        protocolSubmissionDetail.setYesVote(
            BigInteger.valueOf(protocolSubmission.getYesVoteCount()));
      } else {
        protocolSubmissionDetail.setYesVote(BigInteger.ZERO);
      }
      if (protocolSubmission.getNoVoteCount() != null) {
        protocolSubmissionDetail.setNoVote(BigInteger.valueOf(protocolSubmission.getNoVoteCount()));
      } else {
        protocolSubmissionDetail.setNoVote(BigInteger.ZERO);
      }
      if (protocolSubmission.getAbstainerCount() != null) {
        protocolSubmissionDetail.setAbstainerCount(
            BigInteger.valueOf(protocolSubmission.getAbstainerCount()));
      } else {
        protocolSubmissionDetail.setAbstainerCount(BigInteger.ZERO);
      }
      protocolSubmissionDetail.setVotingComments(protocolSubmission.getVotingComments());

      setProtocolSubmissionAction(protocolSubmission, protocol, protocolSubmissionDetail);
      if (protocolSubmission.getSubmissionDate() != null) {
        protocolSubmissionDetail.setSubmissionDate(
            getDateTimeService().getCalendar(protocolSubmission.getSubmissionDate()));
      }
      setSubmissionCheckListinfo(protocolSubmission, protocolSubmissionDetail);
      setProtocolSubmissionReviewers(protocolSubmission, protocolSubmissionDetail);
      List<ProtocolPersonBase> protocolPersons = protocol.getProtocolPersons();
      for (ProtocolPersonBase protocolPerson : protocolPersons) {
        if (protocolPerson
                .getProtocolPersonRoleId()
                .equals(ProtocolPersonRole.ROLE_PRINCIPAL_INVESTIGATOR)
            || protocolPerson
                .getProtocolPersonRoleId()
                .equals(ProtocolPersonRole.ROLE_CO_INVESTIGATOR)) {
          Investigator investigator = protocolSummary.addNewInvestigator();
          getIrbPrintXmlUtilService()
              .setPersonRolodexType((ProtocolPerson) protocolPerson, investigator.addNewPerson());
          if (protocolPerson
              .getProtocolPersonRoleId()
              .equals(ProtocolPersonRole.ROLE_PRINCIPAL_INVESTIGATOR)) {
            investigator.setPIFlag(true);
          }
        }
      }
      List<ProtocolRiskLevel> cvRiskLevels = protocol.getProtocolRiskLevels();
      for (ProtocolRiskLevel protocolRiskLevelBean : cvRiskLevels) {
        edu.mit.irb.irbnamespace.ProtocolSummaryDocument.ProtocolSummary.RiskLevels riskLevelType =
            protocolSummary.addNewRiskLevels();
        riskLevelType.setRiskLevelDescription(
            protocolRiskLevelBean.getRiskLevel().getDescription());
        riskLevelType.setComments(protocolRiskLevelBean.getComments());
      }

      List<ProtocolFundingSource> vecFundingSource = (List) protocol.getProtocolFundingSources();
      int fundingSourceTypeCode;
      String fundingSourceName, fundingSourceCode;
      for (ProtocolFundingSource protocolFundingSourceBean : vecFundingSource) {
        protocolFundingSourceBean.refreshNonUpdateableReferences();
        edu.mit.irb.irbnamespace.ProtocolSummaryDocument.ProtocolSummary.FundingSource
            fundingSource = protocolSummary.addNewFundingSource();
        fundingSourceCode = protocolFundingSourceBean.getFundingSourceNumber();
        fundingSourceTypeCode =
            Integer.valueOf(protocolFundingSourceBean.getFundingSourceTypeCode());
        fundingSourceName = getFundingSourceNameForType(fundingSourceTypeCode, fundingSourceCode);

        fundingSource.setFundingSourceName(fundingSourceName);
        if (protocolFundingSourceBean.getFundingSourceType() != null) {
          fundingSource.setTypeOfFundingSource(
              protocolFundingSourceBean.getFundingSourceType().getDescription());
        }
      }

      getIrbPrintXmlUtilService()
          .setProcotolMinutes(committeeSchedule, protocolSubmission, protocolSubmissionType);
    }
    setOtherActionItems(committeeSchedule, schedule);
    return schedule;
  }