/**
   * Create AddressDataType from Person
   *
   * @param person Person
   * @return AddressDataType corresponding to the KcPerson object.
   */
  public AddressDataType getAddressDataType(KcPerson person) {
    AddressDataType addressType = AddressDataType.Factory.newInstance();
    if (person != null) {

      String street1 = person.getAddressLine1();
      addressType.setStreet1(street1);
      String street2 = person.getAddressLine2();
      if (street2 != null && !street2.equals("")) {
        addressType.setStreet2(street2);
      }
      String city = person.getCity();
      addressType.setCity(city);
      String county = person.getCounty();
      if (county != null && !county.equals("")) {
        addressType.setCounty(county);
      }
      String country = person.getCountryCode();
      String state = person.getState();
      if (state != null && !state.equals("")) {
        addressType.setState(getStateCodeDataType(country, state));
      }
      String postalCode = person.getPostalCode();
      if (postalCode != null && !postalCode.equals("")) {
        addressType.setZipPostalCode(postalCode);
      }
      addressType.setCountry(getCountryCodeDataType(country));
    }
    return addressType;
  }
  /**
   * Create AddressDataType from ProposalPerson
   *
   * @param person ProposalPerson
   * @return AddressDataType corresponding to the ProposalPerson object.
   */
  public AddressDataType getAddressDataType(ProposalPerson person) {
    AddressDataType addressType = AddressDataType.Factory.newInstance();
    if (person != null) {
      String street1 = person.getAddressLine1();
      addressType.setStreet1(street1);
      String street2 = person.getAddressLine2();
      if (street2 != null && !street2.equals("")) {
        addressType.setStreet2(street2);
      }
      String city = person.getCity();
      addressType.setCity(city);

      String postalCode = person.getPostalCode();
      if (postalCode != null && !postalCode.equals("")) {
        addressType.setZipPostalCode(postalCode);
      }
      if (person.getCounty() != null) {
        addressType.setCounty(person.getCounty());
      }

      String county = person.getCounty();
      if (county != null && !county.equals("")) {
        addressType.setCounty(county);
      }
      String country = person.getCountryCode();
      CountryCodeDataType.Enum countryCodeDataType = getCountryCodeDataType(country);
      addressType.setCountry(countryCodeDataType);

      String state = person.getState();
      if (state != null && !state.equals("")) {
        if (countryCodeDataType != null) {
          if (countryCodeDataType.equals(CountryCodeDataType.USA_UNITED_STATES)) {
            addressType.setState(getStateCodeDataType(country, state));
          } else {
            addressType.setProvince(person.getState());
          }
        }
      }
    }
    return addressType;
  }
Esempio n. 3
0
 /**
  * This method is used to get AOR Information for RRSf424
  *
  * @return aorInfoType(AORInfoType) Authorized representative information.
  */
 private AORInfoType getAORInfoType() {
   ProposalSite applicantOrganization = pdDoc.getDevelopmentProposal().getApplicantOrganization();
   AORInfoType aorInfoType = AORInfoType.Factory.newInstance();
   if (departmentalPerson != null) {
     aorInfoType.setName(globLibV20Generator.getHumanNameDataType(departmentalPerson));
     if (departmentalPerson.getPrimaryTitle() != null) {
       if (departmentalPerson.getPrimaryTitle().length() > PRIMARY_TITLE_MAX_LENGTH) {
         aorInfoType.setTitle(
             departmentalPerson.getPrimaryTitle().substring(0, PRIMARY_TITLE_MAX_LENGTH));
       } else {
         aorInfoType.setTitle(departmentalPerson.getPrimaryTitle());
       }
     } else {
       aorInfoType.setTitle("");
     }
     AddressDataType address = AddressDataType.Factory.newInstance();
     address.setStreet1(departmentalPerson.getAddress1());
     address.setStreet2(departmentalPerson.getAddress2());
     address.setCity(departmentalPerson.getCity());
     if (departmentalPerson.getState() != null) {
       address.setState(
           globLibV20Generator.getStateCodeDataType(
               departmentalPerson.getCountryCode(), departmentalPerson.getState()));
     }
     address.setZipPostalCode(departmentalPerson.getPostalCode());
     if (departmentalPerson.getCountryCode() != null) {
       address.setCountry(
           globLibV20Generator.getCountryCodeDataType(departmentalPerson.getCountryCode()));
     }
     aorInfoType.setAddress(address);
     aorInfoType.setPhone(departmentalPerson.getOfficePhone());
     aorInfoType.setFax(departmentalPerson.getFaxNumber());
     aorInfoType.setDepartmentName(departmentalPerson.getDirDept());
     aorInfoType.setEmail(departmentalPerson.getEmailAddress());
     if (departmentalPerson.getHomeUnit() != null) {
       aorInfoType.setDivisionName(departmentalPerson.getHomeUnit());
     }
   }
   if (applicantOrganization != null) {
     aorInfoType.setOrganizationName(applicantOrganization.getLocationName());
   }
   return aorInfoType;
 }