@Override
  public void setPrincipalInvestigator(
      ProtocolPersonBase newPrincipalInvestigator, ProtocolBase protocol) {
    if (protocol != null) {
      ProtocolPerson currentPrincipalInvestigator =
          (ProtocolPerson) getPrincipalInvestigator(protocol.getProtocolPersons());

      if (newPrincipalInvestigator != null) {
        newPrincipalInvestigator.setProtocolPersonRoleId(getPrincipalInvestigatorRole());
        if (currentPrincipalInvestigator == null) {
          protocol.getProtocolPersons().add(newPrincipalInvestigator);
        } else if (!isDuplicatePerson(protocol.getProtocolPersons(), newPrincipalInvestigator)) {
          protocol.getProtocolPersons().remove(currentPrincipalInvestigator);
          protocol.getProtocolPersons().add(newPrincipalInvestigator);
        }

        // Assign the PI the APPROVER role if PI has a personId (for doc cancel).
        if (newPrincipalInvestigator.getPersonId() != null) {
          personEditableService.populateContactFieldsFromPersonId(newPrincipalInvestigator);
          KcAuthorizationService kraAuthService =
              KcServiceLocator.getService(KcAuthorizationService.class);
          kraAuthService.addDocumentLevelRole(
              newPrincipalInvestigator.getPersonId(), RoleConstants.PROTOCOL_APPROVER, protocol);
        } else {
          personEditableService.populateContactFieldsFromRolodexId(newPrincipalInvestigator);
        }
      }
    }
  }
  @Override
  public boolean hasDerivedRole(
      String principalId,
      List<String> groupIds,
      String namespaceCode,
      String roleName,
      Map<String, String> qualification) {
    validateRequiredAttributesAgainstReceived(qualification);

    String protocolNumber = qualification.get(KcKimAttributes.PROTOCOL);

    ProtocolBase protocol = getProtocol(protocolNumber);

    if (protocol != null && CollectionUtils.isNotEmpty(protocol.getProtocolPersons())) {
      for (ProtocolPersonBase person : protocol.getProtocolPersons()) {
        // Find protocol person that matches the principal id
        if (StringUtils.equals(principalId, person.getPersonId())) {
          if (StringUtils.equals(roleName, person.getProtocolPersonRoleId())) {
            return true;
          }
        }
      }
    }

    return false;
  }
  private List<String> getPersonnelIds(ProtocolBase protocol) {
    List<String> PersonnelIds = new ArrayList<String>();
    for (ProtocolPersonBase person : protocol.getProtocolPersons()) {
      if (StringUtils.isNotBlank(person.getPersonId())) {
        PersonnelIds.add(person.getPersonId());
      } else {
        PersonnelIds.add(person.getRolodexId().toString());
      }
    }

    return PersonnelIds;
  }
  /**
   * This method is for several fields that does not have inquiry created by lookup frame work.
   * Also, disable inquiry link for protocol title & schedule date.
   *
   * @see
   *     org.kuali.core.lookup.AbstractLookupableHelperServiceImpl#getInquiryUrl(org.kuali.core.bo.BusinessObject,
   *     java.lang.String)
   */
  @Override
  public HtmlData getInquiryUrl(BusinessObject bo, String propertyName) {

    BusinessObject inqBo = bo;
    String inqPropertyName = propertyName;
    HtmlData inqUrl = new AnchorHtmlData();
    if (!COMMITTEE_SCHEDULE_SCHEDULE_DATE.equals(propertyName)
        && !PROTOCOL_TITLE.equals(propertyName)) {
      if (PROTOCOL_NUMBER.equals(propertyName)) {
        inqBo = ((ProtocolSubmissionBase) bo).getProtocol();
      } else if (propertyName.equals(COMMITTEE_ID)) {
        inqBo = ((ProtocolSubmissionBase) bo).getCommittee();

      } else if ("piName".equals(propertyName)) {
        // -- commented as part of GENERATED CODE need to verify
        ProtocolBase protocol = ((ProtocolSubmissionBase) bo).getProtocol();
        ProtocolPersonBase principalInvestigator = protocol.getPrincipalInvestigator();
        if (principalInvestigator != null) {
          if (StringUtils.isNotBlank(principalInvestigator.getPersonId())) {
            inqBo = this.kcPersonService.getKcPersonByPersonId(principalInvestigator.getPersonId());
            inqPropertyName = ProtocolLookupConstants.Property.PERSON_ID;
          } else {
            if (principalInvestigator.getRolodexId() != null) {
              inqBo = new Rolodex();
              ((Rolodex) inqBo).setRolodexId(principalInvestigator.getRolodexId());
              inqPropertyName = ProtocolLookupConstants.Property.ROLODEX_ID;
            }
          }
        }
      }
      if (inqBo != null) {
        // withdraw committeeidfk = null will cause inqbo=null
        inqUrl = super.getInquiryUrl(inqBo, inqPropertyName);
      }
    }
    return inqUrl;
  }
  @Override
  public List<RoleMembership> getRoleMembersFromDerivedRole(
      String namespaceCode, String roleName, Map<String, String> qualification) {
    validateRequiredAttributesAgainstReceived(qualification);

    List<RoleMembership> members = new ArrayList<RoleMembership>();

    String protocolNumber = qualification.get(KcKimAttributes.PROTOCOL);
    ProtocolBase protocol = getProtocol(protocolNumber);

    if (protocol != null && CollectionUtils.isNotEmpty(protocol.getProtocolPersons())) {
      for (ProtocolPersonBase person : protocol.getProtocolPersons()) {
        if (StringUtils.equals(person.getProtocolPersonRoleId(), roleName)
            && StringUtils.isNotBlank(person.getPerson().getPersonId())) {
          members.add(
              RoleMembership.Builder.create(
                      null, null, person.getPerson().getPersonId(), MemberType.PRINCIPAL, null)
                  .build());
        }
      }
    }

    return members;
  }
示例#6
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;
  }