Пример #1
0
  /**
   * This method returns LobbyingActivitiesDisclosureDocument object based on proposal development
   * document which contains the LobbyingActivitiesDisclosureDocument informations
   * FederalActionType,FederalActionStatus,ReportType,ReportEntity,FederalAgencyDepartment,
   * FederalProgramName,LobbyingRegistrant,IndividualsPerformingServices,SignatureBlock and
   * LobbyingActivitiesDisclosure for a particular proposal
   *
   * @return lobbyingADDocument {@link XmlObject} of type LobbyingActivitiesDisclosureDocument.
   */
  private LobbyingActivitiesDisclosureDocument getLobbyingActivitiesDisclosure() {

    LobbyingActivitiesDisclosureDocument lobbyingADDocument =
        LobbyingActivitiesDisclosureDocument.Factory.newInstance();
    LobbyingActivitiesDisclosure lobbyingDisclosure =
        LobbyingActivitiesDisclosure.Factory.newInstance();
    lobbyingDisclosure.setFormVersion(S2SConstants.FORMVERSION_1_0);
    lobbyingDisclosure.setFederalActionType(FederalActionType.GRANT);
    lobbyingDisclosure.setFederalActionStatus(FederalActionStatus.BID_OFFER);
    lobbyingDisclosure.setReportType(ReportDataType.INITIAL_FILING);
    lobbyingDisclosure.setReportEntity(getReportEntity());
    lobbyingDisclosure.setFederalAgencyDepartment("");
    Sponsor sponsor = pdDoc.getDevelopmentProposal().getSponsor();
    if (sponsor != null) {
      if (sponsor.getSponsorName() != null) {
        if (sponsor.getSponsorName().length() > SPONSOR_NAME_MAX_LENGTH) {
          lobbyingDisclosure.setFederalAgencyDepartment(
              sponsor.getSponsorName().substring(0, SPONSOR_NAME_MAX_LENGTH));
        } else {
          lobbyingDisclosure.setFederalAgencyDepartment(sponsor.getSponsorName());
        }
      }
    } else {
      String primeSponsorCode = pdDoc.getDevelopmentProposal().getPrimeSponsorCode();

      if (primeSponsorCode != null) {
        BusinessObjectService businessObjectService =
            KraServiceLocator.getService(BusinessObjectService.class);
        Map<String, String> sponsorMap = new HashMap<String, String>();
        sponsorMap.put(KEY_SPONSOR_CODE, primeSponsorCode);
        Sponsor primeSponsor =
            (Sponsor) businessObjectService.findByPrimaryKey(Sponsor.class, sponsorMap);
        if (primeSponsor.getSponsorName() != null) {
          if (primeSponsor.getSponsorName().length() > SPONSOR_NAME_MAX_LENGTH) {
            lobbyingDisclosure.setFederalAgencyDepartment(
                primeSponsor.getSponsorName().substring(0, SPONSOR_NAME_MAX_LENGTH));
          } else {
            lobbyingDisclosure.setFederalAgencyDepartment(primeSponsor.getSponsorName());
          }
        }
      }
    }
    lobbyingDisclosure.setFederalProgramName(getFedProgramName());
    lobbyingDisclosure.setLobbyingRegistrant(getLobbyingRegistrant());
    lobbyingDisclosure.setIndividualsPerformingServices(getIndividualsPerformingServices());
    lobbyingDisclosure.setSignatureBlock(getSignatureBlock());
    lobbyingADDocument.setLobbyingActivitiesDisclosure(lobbyingDisclosure);
    return lobbyingADDocument;
  }
 // Check whether the Sponsor has already been added.
 private boolean isDuplicateSponsor(
     Sponsor sponsor, List<AwardTransferringSponsor> awardTransferringSponsors) {
   for (AwardTransferringSponsor awardTransferringSponsor : awardTransferringSponsors) {
     if (awardTransferringSponsor.getSponsorCode().equals(sponsor.getSponsorCode())) {
       return true;
     }
   }
   return false;
 }