Пример #1
0
  public static void addproviderContact(AccountEntity account, Document doc, Element parent) {
    if (account.getPrimaryContact() != null) {
      Element providerContactTag = doc.createElement("providerContact");
      parent.appendChild(providerContactTag);
      if (account.getPrimaryContact().getFirstName() != null) {
        Element firstName = doc.createElement("firstName");
        Text firstNameTxt = doc.createTextNode(account.getPrimaryContact().getFirstName());
        firstName.appendChild(firstNameTxt);
        providerContactTag.appendChild(firstName);
      }

      if (account.getPrimaryContact().getLastName() != null) {
        Element name = doc.createElement("lastname");
        Text nameTxt = doc.createTextNode(account.getPrimaryContact().getLastName());
        name.appendChild(nameTxt);
        providerContactTag.appendChild(name);
      }

      if (account.getPrimaryContact().getEmail() != null) {
        Element email = doc.createElement("email");
        Text emailTxt = doc.createTextNode(account.getPrimaryContact().getEmail());
        email.appendChild(emailTxt);
        providerContactTag.appendChild(email);
      }
      if (account.getPrimaryContact().getFax() != null) {
        Element fax = doc.createElement("fax");
        Text faxTxt = doc.createTextNode(account.getPrimaryContact().getFax());
        fax.appendChild(faxTxt);
        providerContactTag.appendChild(fax);
      }
      if (account.getPrimaryContact().getMobile() != null) {

        Element mobile = doc.createElement("mobile");
        Text mobileTxt = doc.createTextNode(account.getPrimaryContact().getMobile());
        mobile.appendChild(mobileTxt);
        providerContactTag.appendChild(mobile);
      }
      if (account.getPrimaryContact().getPhone() != null) {
        Element phone = doc.createElement("phone");
        Text phoneTxt = doc.createTextNode(account.getPrimaryContact().getPhone());
        phone.appendChild(phoneTxt);
        providerContactTag.appendChild(phone);
      }
    }
  }
Пример #2
0
  public static void addNameAndAdress(AccountEntity account, Document doc, Element parent) {
    if (!(account instanceof Customer)) {
      Element nameTag = doc.createElement("name");
      parent.appendChild(nameTag);

      Element quality = doc.createElement("quality");
      if (account.getName().getTitle() != null) {
        Text qualityTxt = doc.createTextNode(account.getName().getTitle().getCode());
        quality.appendChild(qualityTxt);
      }
      nameTag.appendChild(quality);
      if (account.getName().getFirstName() != null) {
        Element firstName = doc.createElement("firstName");
        Text firstNameTxt = doc.createTextNode(account.getName().getFirstName());
        firstName.appendChild(firstNameTxt);
        nameTag.appendChild(firstName);
      }

      Element name = doc.createElement("name");
      if (account.getName().getLastName() != null) {
        Text nameTxt = doc.createTextNode(account.getName().getLastName());
        name.appendChild(nameTxt);
      }
      nameTag.appendChild(name);
    }
    Element addressTag = doc.createElement("address");
    Element address1 = doc.createElement("address1");
    if (account.getAddress().getAddress1() != null) {
      Text adress1Txt = doc.createTextNode(account.getAddress().getAddress1());
      address1.appendChild(adress1Txt);
    }
    addressTag.appendChild(address1);

    Element address2 = doc.createElement("address2");
    if (account.getAddress().getAddress2() != null) {
      Text adress2Txt = doc.createTextNode(account.getAddress().getAddress2());
      address2.appendChild(adress2Txt);
    }
    addressTag.appendChild(address2);

    Element address3 = doc.createElement("address3");
    if (account.getAddress().getAddress3() != null) {
      Text adress3Txt =
          doc.createTextNode(
              account.getAddress().getAddress3() != null ? account.getAddress().getAddress3() : "");
      address3.appendChild(adress3Txt);
    }
    addressTag.appendChild(address3);

    Element city = doc.createElement("city");
    Text cityTxt =
        doc.createTextNode(
            account.getAddress().getCity() != null ? account.getAddress().getCity() : "");
    city.appendChild(cityTxt);
    addressTag.appendChild(city);

    Element postalCode = doc.createElement("postalCode");
    Text postalCodeTxt =
        doc.createTextNode(
            account.getAddress().getZipCode() != null ? account.getAddress().getZipCode() : "");
    postalCode.appendChild(postalCodeTxt);
    addressTag.appendChild(postalCode);

    Element state = doc.createElement("state");
    addressTag.appendChild(state);

    Element country = doc.createElement("country");
    Text countryTxt =
        doc.createTextNode(
            account.getAddress().getCountry() != null ? account.getAddress().getCountry() : "");
    country.appendChild(countryTxt);
    addressTag.appendChild(country);

    parent.appendChild(addressTag);
  }