예제 #1
0
 private ProtocolAction findProtocolActionForSubmission(
     org.kuali.kra.irb.actions.submit.ProtocolSubmissionLite protocolSubmission,
     Protocol protocol) {
   List<ProtocolActionBase> protocolActions = protocol.getProtocolActions();
   for (ProtocolActionBase protocolAction : protocolActions) {
     if (protocolAction.getSubmissionNumber() != null
         && protocolAction
             .getSubmissionNumber()
             .equals(protocolSubmission.getSubmissionNumber())) {
       return (ProtocolAction) protocolAction;
     }
   }
   return null;
 }
 @Override
 public void iacucLiftHold(ProtocolBase protocol, ProtocolGenericActionBean actionBean)
     throws Exception {
   // find the last lift notification protocol action.
   ProtocolActionBase selectedPa = null;
   for (ProtocolActionBase pa : protocol.getProtocolActions()) {
     if (StringUtils.equalsIgnoreCase(pa.getProtocolActionTypeCode(), IacucProtocolActionType.HOLD)
         && (selectedPa == null || pa.getSequenceNumber() > selectedPa.getSequenceNumber())) {
       selectedPa = pa;
     }
   }
   performGenericAction(
       protocol,
       actionBean,
       IacucProtocolActionType.LIFT_HOLD,
       selectedPa.getPrevProtocolStatusCode());
 }
  protected void buildAndAttachProtocolCorrespondence(
      ProtocolBase protocol, byte[] data, String correspTypeCode) {

    ProtocolCorrespondence protocolCorrespondence = getNewProtocolCorrespondenceHook();
    protocolCorrespondence.setProtocol(protocol);
    protocolCorrespondence.setProtocolId(protocol.getProtocolId());
    protocolCorrespondence.setProtocolNumber(protocol.getProtocolNumber());
    protocolCorrespondence.setSequenceNumber(protocol.getSequenceNumber());
    protocolCorrespondence.setProtoCorrespTypeCode(correspTypeCode);

    ProtocolActionBase lastAction = protocol.getLastProtocolAction();
    protocolCorrespondence.setProtocolAction(lastAction);
    protocolCorrespondence.setActionIdFk(lastAction.getProtocolActionId());
    protocolCorrespondence.setCorrespondence(data);
    protocolCorrespondence.setActionId(lastAction.getActionId());

    // What is Final flag used for? ANSWER: the final flag is used by the IRB admin to denote
    // correspondences
    // that are ready to be sent/published to the PI etc.
    protocolCorrespondence.setFinalFlag(false);
    protocolCorrespondence.setCreateUser(GlobalVariables.getUserSession().getPrincipalName());
    protocolCorrespondence.setCreateTimestamp(dateTimeService.getCurrentTimestamp());

    if (lastAction.getProtocolCorrespondences() == null) {
      List<ProtocolCorrespondence> correspondences = new ArrayList<ProtocolCorrespondence>();
      correspondences.add(protocolCorrespondence);
      lastAction.setProtocolCorrespondences(correspondences);
      protocol.refreshReferenceObject("protocolSubmissions");
    } else {
      lastAction.getProtocolCorrespondences().add(protocolCorrespondence);
    }

    getBusinessObjectService().save(protocolCorrespondence);

    getBusinessObjectService().save(protocol);
  }
예제 #4
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;
  }
  private String getQuestionnaireLabel(AnswerHeader answerHeader) {
    String label = null;
    List<QuestionnaireUsage> usages = answerHeader.getQuestionnaire().getQuestionnaireUsages();
    if (CollectionUtils.isNotEmpty(usages) && usages.size() > 1) {
      Collections.sort((List<QuestionnaireUsage>) usages);
    }
    for (QuestionnaireUsage usage : usages) {
      if (getCoeusModuleCode().equals(usage.getModuleItemCode())
          && answerHeader.getModuleSubItemCode().equals(usage.getModuleSubItemCode())) {
        if ("0".equals(answerHeader.getModuleSubItemCode())) {
          label = usage.getQuestionnaireLabel();
        } else if (CoeusSubModule.PROTOCOL_SUBMISSION.equals(answerHeader.getModuleSubItemCode())) {
          Map keyValues = new HashMap();
          keyValues.put("protocolNumber", answerHeader.getModuleItemKey());
          keyValues.put("submissionNumber", answerHeader.getModuleSubItemKey());

          List<ProtocolSubmissionBase> submissions =
              ((List<ProtocolSubmissionBase>)
                  getBusinessObjectService()
                      .findMatchingOrderBy(
                          getProtocolSubmissionBOClassHook(), keyValues, "submissionId", false));
          if (submissions.isEmpty()) {
            // this may happen if it is undo last action
            label = usage.getQuestionnaireLabel();
          } else {
            keyValues.clear();
            keyValues.put("protocolId", submissions.get(0).getProtocolId());
            keyValues.put("submissionNumber", answerHeader.getModuleSubItemKey());

            ProtocolActionBase protocolAction =
                ((List<ProtocolActionBase>)
                        getBusinessObjectService()
                            .findMatching(getProtocolActionBOClassHook(), keyValues))
                    .get(0);
            label =
                usage.getQuestionnaireLabel()
                    + " - "
                    + protocolAction.getProtocolActionType().getDescription()
                    + " - "
                    + protocolAction.getActionDateString();
          }
        } else if (CoeusSubModule.AMENDMENT_RENEWAL.equals(answerHeader.getModuleSubItemCode())) {
          if (answerHeader.getModuleItemKey().contains("A")) {
            label =
                usage.getQuestionnaireLabel()
                    + " - Amendment "
                    + answerHeader.getModuleItemKey().substring(10);
          } else {
            label =
                usage.getQuestionnaireLabel()
                    + " - Renewal "
                    + answerHeader.getModuleItemKey().substring(10);
          }
        } else if (CoeusSubModule.AMENDMENT.equals(answerHeader.getModuleSubItemCode())) {
          if (answerHeader.getModuleItemKey().contains("A")) {
            label =
                usage.getQuestionnaireLabel()
                    + " - Amendment "
                    + answerHeader.getModuleItemKey().substring(10);
          }
        } else if (CoeusSubModule.RENEWAL.equals(answerHeader.getModuleSubItemCode())) {
          if (answerHeader.getModuleItemKey().contains("R")) {
            label =
                usage.getQuestionnaireLabel()
                    + " - Renewal "
                    + answerHeader.getModuleItemKey().substring(10);
          }
        }
      }
    }
    return label;
  }