public ProposalDevelopmentDocument() {
   super();
   DevelopmentProposal newProposal = new DevelopmentProposal();
   newProposal.setProposalDocument(this);
   developmentProposal = newProposal;
   budgetDocumentVersions = new ArrayList<BudgetDocumentVersion>();
   customDataList = new ArrayList<CustomAttributeDocValue>();
 }
 /*
  * This method will get the Organization from the Development proposal.
  */
 private Organization getOrganizationFromDevelopmentProposal(
     DevelopmentProposal developmentProposal) {
   Organization organization = null;
   ProposalSite proposalSite = developmentProposal.getApplicantOrganization();
   if (proposalSite != null) {
     organization = proposalSite.getOrganization();
   }
   return organization;
 }
Exemple #3
0
 /**
  * This method is used to get details of Principal Investigator for Organization Contact
  *
  * @return OrganizationContactPersonDataType Principal investigator details.
  */
 private OrganizationContactPersonDataType getPDPI() {
   OrganizationContactPersonDataType PDPI =
       OrganizationContactPersonDataType.Factory.newInstance();
   ProposalPerson PI = null;
   for (ProposalPerson proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) {
     if (PRINCIPAL_INVESTIGATOR.equals(proposalPerson.getProposalPersonRoleId())) {
       PI = proposalPerson;
       ProposalSite applicantOrganization =
           pdDoc.getDevelopmentProposal().getApplicantOrganization();
       PDPI.setName(globLibV20Generator.getHumanNameDataType(PI));
       PDPI.setPhone(PI.getOfficePhone());
       PDPI.setEmail(PI.getEmailAddress());
       if (PI.getFaxNumber() != null) {
         PDPI.setFax(PI.getFaxNumber());
       }
       PDPI.setAddress(globLibV20Generator.getAddressDataType(PI));
       if (PI.getDirectoryTitle() != null) {
         if (PI.getDirectoryTitle().length() > DIRECTORY_TITLE_MAX_LENGTH) {
           PDPI.setTitle(PI.getDirectoryTitle().substring(0, DIRECTORY_TITLE_MAX_LENGTH));
         } else {
           PDPI.setTitle(PI.getDirectoryTitle());
         }
       }
       if (PI.getHomeUnit() != null) {
         KcPerson kcPerson = PI.getPerson();
         String departmentName = kcPerson.getOrganizationIdentifier();
         PDPI.setDepartmentName(departmentName);
       } else {
         DevelopmentProposal developmentProposal = pdDoc.getDevelopmentProposal();
         PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
       }
       // divisionName
       String divisionName = proposalPerson.getDivision();
       if (divisionName != null) {
         PDPI.setDivisionName(divisionName);
       }
       if (applicantOrganization != null) {
         PDPI.setOrganizationName(applicantOrganization.getLocationName());
       }
     }
   }
   return PDPI;
 }
 public void defaultDocumentDescription() {
   DevelopmentProposal proposal = getDevelopmentProposal();
   String desc =
       String.format(
           "%s; Proposal No: %s; PI: %s; Sponsor: %s; Due Date: %s",
           proposal.getTitle() != null
               ? proposal.getTitle().substring(0, Math.min(proposal.getTitle().length(), 19))
               : "null",
           proposal.getProposalNumber(),
           proposal.getPrincipalInvestigatorName(),
           proposal.getSponsorName(),
           proposal.getDeadlineDate() != null
               ? getDateTimeService().toDateString(proposal.getDeadlineDate())
               : "null");
   getDocumentHeader().setDocumentDescription(desc);
 }
  protected void populateRequiredFields(
      Protocol protocol, ProposalDevelopmentDocument proposalDocument) throws Exception {
    DevelopmentProposal developmentProposal = proposalDocument.getDevelopmentProposal();

    developmentProposal.setTitle(protocol.getTitle());
    developmentProposal.setOwnedByUnit(protocol.getLeadUnit().getUnit());
    developmentProposal.setOwnedByUnitNumber(protocol.getLeadUnitNumber());
    developmentProposal.setRequestedStartDateInitial(new Date(System.currentTimeMillis()));

    ParameterService parameterService = KraServiceLocator.getService(ParameterService.class);
    String projectEndDateParameter =
        parameterService.getParameterValueAsString(
            ProtocolDocument.class,
            ProtocolProposalDevelopmentDocumentService.PROJECT_END_DATE_NUMBER_OF_YEARS);
    int numberOfYears = Integer.parseInt(projectEndDateParameter);
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.YEAR, numberOfYears);
    calendar.add(Calendar.DATE, -1);
    Date projectEndDate = new Date(calendar.getTimeInMillis());
    developmentProposal.setRequestedEndDateInitial(projectEndDate);

    String activityTypeCode =
        ProposalDevelopmentUtils.getProposalDevelopmentDocumentParameter(
            ProposalDevelopmentUtils.ACTIVITY_TYPE_CODE_RESEARCH_PARM);
    String proposalTypeCode =
        ProposalDevelopmentUtils.getProposalDevelopmentDocumentParameter(
            ProposalDevelopmentUtils.PROPOSAL_TYPE_CODE_NEW_PARM);

    developmentProposal.setActivityTypeCode(activityTypeCode);
    developmentProposal.setProposalTypeCode(proposalTypeCode);

    // find sponsor from funding source
    List<ProtocolFundingSourceBase> protocolFundingSources = protocol.getProtocolFundingSources();
    ProtocolFundingSource sponsorProtocolFundingSource = null;
    for (ProtocolFundingSourceBase protocolFundingSource : protocolFundingSources) {
      if (protocolFundingSource.isSponsorFunding()) {
        sponsorProtocolFundingSource = (ProtocolFundingSource) protocolFundingSource;
        break;
      }
    }
    if (sponsorProtocolFundingSource != null) {
      developmentProposal.setSponsorCode(sponsorProtocolFundingSource.getFundingSourceNumber());
    }
  }
  public boolean processRunAuditBusinessRules(Document document) {

    boolean valid = true;
    ProposalDevelopmentDocument proposalDevelopmentDocument =
        (ProposalDevelopmentDocument) document;
    DevelopmentProposal developmentProposal = proposalDevelopmentDocument.getDevelopmentProposal();
    S2sOpportunity opp = developmentProposal.getS2sOpportunity();

    if (opp != null && opp.getS2sOppForms() != null) {
      for (S2sOppForms oppforms : opp.getS2sOppForms()) {
        List<QuestionnaireUsage> usages =
            getProposalDevelopmentS2sQuestionnaireService()
                .getQuestionnaireUsages(
                    oppforms.getOppNameSpace(), oppforms.getFormName(), developmentProposal);
        // if the returned usages list is empty, there are no Questionnaires for that opp form.
        if (usages.size() > 0) {
          List<AnswerHeader> headers =
              proposalDevelopmentS2sQuestionnaireService.getProposalAnswerHeaderForForm(
                  developmentProposal, oppforms.getOppNameSpace(), oppforms.getFormName());
          for (int i = 0; i < headers.size(); i++) {
            AnswerHeader header = headers.get(i);
            if (!header.getCompleted()) {
              valid = false;
              getProposalS2sAuditErrorsByGroup(
                      "s2sQuestionnaireHelper", usages.get(0).getQuestionnaireLabel(), i)
                  .add(
                      new AuditError(
                          String.format(PROPOSAL_S2S_QUESTIONS_KEY, i),
                          KeyConstants.ERROR_S2S_QUESTIONNAIRE_NOT_COMPLETE,
                          Constants.QUESTIONS_PAGE + "." + usages.get(0).getQuestionnaireLabel(),
                          new String[] {usages.get(0).getQuestionnaireLabel()}));
            }
          }
        }
      }
    }
    return valid;
  }
 @Override
 public void doRouteStatusChange(DocumentRouteStatusChange dto) {
   super.doRouteStatusChange(dto);
   String newStatus = dto.getNewRouteStatus();
   String oldStatus = dto.getOldRouteStatus();
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         String.format(
             "Route Status change for document %s from %s to %s",
             this.getDocumentNumber(), oldStatus, newStatus));
   }
   if (!isProposalDeleted()) {
     DevelopmentProposal bp = this.getDevelopmentProposal();
     LOG.info(
         String.format(
             "Route status change for document %s - proposal number %s is moving from %s to %s",
             bp.getProposalDocument().getDocumentHeader().getDocumentNumber(),
             bp.getProposalNumber(),
             oldStatus,
             newStatus));
     if (bp.isParent()) {
       try {
         getProposalHierarchyService().routeHierarchyChildren(this, dto);
       } catch (ProposalHierarchyException e) {
         throw new RuntimeException(
             "ProposalHierarchyException thrown while routing children.", e);
       }
     } else if (!bp.isInHierarchy()) {
       try {
         getProposalHierarchyService().calculateAndSetProposalAppDocStatus(this, dto);
       } catch (ProposalHierarchyException pe) {
         throw new RuntimeException(
             String.format(
                 "ProposalHierarchyException thrown while updating app doc status for document %s",
                 getDocumentNumber()));
       }
     }
     bp.setProposalStateTypeCode(
         getProposalStateService().getProposalStateTypeCode(this, true, false));
   }
 }
Exemple #8
0
  /**
   * This method gives information of applications that are used in RRSF424
   *
   * @return rrSF424Document {@link XmlObject} of type RRSF424Document.
   */
  private RRSF424Document getRRSF424() {
    DevelopmentProposal devProp = pdDoc.getDevelopmentProposal();

    RRSF424Document rrSF424Document = RRSF424Document.Factory.newInstance();
    RRSF424 rrsf424 = RRSF424.Factory.newInstance();
    rrsf424.setFormVersion(S2SConstants.FORMVERSION_1_1);
    S2sOpportunity s2sOpportunity = devProp.getS2sOpportunity();
    if (s2sOpportunity != null && s2sOpportunity.getS2sSubmissionTypeCode() != null) {
      s2sOpportunity.refreshNonUpdateableReferences();
      rrsf424.setSubmissionTypeCode(
          SubmissionTypeDataType.Enum.forString(
              devProp.getS2sOpportunity().getS2sSubmissionType().getDescription()));
    }
    rrsf424.setSubmittedDate(Calendar.getInstance());
    Organization applicantOrganization = devProp.getApplicantOrganization().getOrganization();
    if (applicantOrganization != null && applicantOrganization.getRolodex() != null) {
      String state = applicantOrganization.getRolodex().getState();
      rrsf424.setStateID(state);
    }
    String federalId = proposalDevelopmentService.getFederalId(pdDoc);
    if (federalId != null) {
      if (federalId.length() > 30) {
        rrsf424.setFederalID(federalId.substring(0, 30));
      } else {
        rrsf424.setFederalID(federalId);
      }
    }
    rrsf424.setApplicantInfo(getApplicationInfo());
    rrsf424.setApplicantType(getApplicantType());
    rrsf424.setApplicationType(getApplicationType());
    boolean isNih =
        isSponsorInHierarchy(pdDoc.getDevelopmentProposal(), SPONSOR_GROUPS, SPONSOR_NIH);
    if (applicantOrganization != null) {
      if (applicantOrganization.getPhsAccount() != null && isNih) {
        rrsf424.setEmployerID(applicantOrganization.getPhsAccount());
      } else {
        rrsf424.setEmployerID(applicantOrganization.getFedralEmployerId());
      }
    }
    Sponsor sponsor = devProp.getSponsor();
    if (sponsor != null) {
      rrsf424.setFederalAgencyName(sponsor.getSponsorName());
    }
    if (devProp.getCfdaNumber() != null) {
      rrsf424.setCFDANumber(devProp.getCfdaNumber());
    }
    if (devProp.getProgramAnnouncementTitle() != null) {
      String announcementTitle;
      if (devProp.getProgramAnnouncementTitle().length() > 120) {
        announcementTitle = devProp.getProgramAnnouncementTitle().substring(0, 120);
      } else {
        announcementTitle = devProp.getProgramAnnouncementTitle();
      }
      rrsf424.setActivityTitle(announcementTitle);
    }
    rrsf424.setProjectTitle(devProp.getTitle());
    if (devProp.getProposalAbstracts() != null) {
      List<ProposalAbstract> proposalAbstractList = devProp.getProposalAbstracts();
      String state = "";
      for (ProposalAbstract proposalAbstract : proposalAbstractList) {
        if (proposalAbstract.getAbstractTypeCode().equals(AREAS_AFFECTED_ABSTRACT_TYPE_CODE))
          state = proposalAbstract.getAbstractDetails();
      }
      rrsf424.setLocation(state);
    }
    rrsf424.setProposedProjectPeriod(getProjectPeriod());
    rrsf424.setCongressionalDistrict(getCongDistrict());
    rrsf424.setPDPIContactInfo(getPDPI());
    try {
      rrsf424.setEstimatedProjectFunding(getProjectFunding());
    } catch (S2SException e) {
      LOG.error(e.getMessage(), e);
      return rrSF424Document;
    }
    rrsf424.setStateReview(getStateReview());
    // Value is hardcoded
    rrsf424.setTrustAgree(YesNoDataType.Y_YES);
    rrsf424.setAORInfo(getAORInfoType());
    for (Narrative narrative : devProp.getNarratives()) {
      AttachedFileDataType attachedFileDataType = null;
      switch (Integer.parseInt(narrative.getNarrativeTypeCode())) {
        case (PRE_APPLICATION):
          attachedFileDataType = getAttachedFileType(narrative);
          if (attachedFileDataType != null) {
            rrsf424.setPreApplicationAttachment(attachedFileDataType);
          }
          break;
        case (ADDITIONAL_CONGRESSIONAL_DESTRICT):
          attachedFileDataType = getAttachedFileType(narrative);
          if (attachedFileDataType != null) {
            rrsf424.setAdditionalCongressionalDistricts(attachedFileDataType);
          }
          break;
      }
    }
    if (departmentalPerson != null) {
      rrsf424.setAORSignature(departmentalPerson.getFullName());
    } else {
      rrsf424.setAORSignature("");
    }
    rrsf424.setAORSignedDate(Calendar.getInstance());
    rrSF424Document.setRRSF424(rrsf424);
    return rrSF424Document;
  }