Example usage for javax.xml.registry.infomodel PostalAddress getType

List of usage examples for javax.xml.registry.infomodel PostalAddress getType

Introduction

In this page you can find the example usage for javax.xml.registry.infomodel PostalAddress getType.

Prototype

public String getType() throws JAXRException;

Source Link

Document

Returns the type of address (for example, "headquarters") as a String.

Usage

From source file:org.apache.ws.scout.util.ScoutJaxrUddiV3Helper.java

/**
 * Get UDDI Address given JAXR Postal Address
 *///from   w ww  . ja v a2  s  .  c o m
public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
    Address address = objectFactory.createAddress();

    AddressLine[] addarr = new AddressLine[7];

    String stnum = postalAddress.getStreetNumber();
    String st = postalAddress.getStreet();
    String city = postalAddress.getCity();
    String country = postalAddress.getCountry();
    String code = postalAddress.getPostalCode();
    String state = postalAddress.getStateOrProvince();
    String type = postalAddress.getType();

    AddressLine stnumAL = objectFactory.createAddressLine();
    stnumAL.setKeyName("STREET_NUMBER");
    if (stnum != null) {
        stnumAL.setKeyValue("STREET_NUMBER");
        stnumAL.setValue(stnum);
    }

    AddressLine stAL = objectFactory.createAddressLine();
    stAL.setKeyName("STREET");
    if (st != null) {
        stAL.setKeyValue("STREET");
        stAL.setValue(st);
    }

    AddressLine cityAL = objectFactory.createAddressLine();
    cityAL.setKeyName("CITY");
    if (city != null) {
        cityAL.setKeyValue("CITY");
        cityAL.setValue(city);
    }

    AddressLine countryAL = objectFactory.createAddressLine();
    countryAL.setKeyName("COUNTRY");
    if (country != null) {
        countryAL.setKeyValue("COUNTRY");
        countryAL.setValue(country);
    }

    AddressLine codeAL = objectFactory.createAddressLine();
    codeAL.setKeyName("POSTALCODE");
    if (code != null) {
        codeAL.setKeyValue("POSTALCODE");
        codeAL.setValue(code);
    }

    AddressLine stateAL = objectFactory.createAddressLine();
    stateAL.setKeyName("STATE");
    if (state != null) {
        stateAL.setKeyValue("STATE");
        stateAL.setValue(state);
    }

    AddressLine typeAL = objectFactory.createAddressLine();
    typeAL.setKeyName("TYPE");
    if (type != null) {
        typeAL.setKeyValue("TYPE");
        typeAL.setValue(type);
    }

    // Add the AddressLine to vector
    addarr[0] = stnumAL;
    addarr[1] = stAL;
    addarr[2] = cityAL;
    addarr[3] = countryAL;
    addarr[4] = codeAL;
    addarr[5] = stateAL;
    addarr[6] = typeAL;

    address.getAddressLine().addAll(Arrays.asList(addarr));

    return address;
}