コード例 #1
0
ファイル: RRSF424V1_1Generator.java プロジェクト: kgeis/kc
  /**
   * 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;
  }
コード例 #2
0
ファイル: RRSF424V1_1Generator.java プロジェクト: kgeis/kc
 /**
  * This method typecasts the given {@link XmlObject} to the required generator type and returns
  * back the document of that generator type.
  *
  * @param xmlObject which needs to be converted to the document type of the required generator
  * @return {@link XmlObject} document of the required generator type
  * @see org.kuali.kra.s2s.generator.S2SFormGenerator#getFormObject(XmlObject)
  */
 public XmlObject getFormObject(XmlObject xmlObject) {
   RRSF424 rrsf424 = (RRSF424) xmlObject;
   RRSF424Document rrSF424Document = RRSF424Document.Factory.newInstance();
   rrSF424Document.setRRSF424(rrsf424);
   return rrSF424Document;
 }