private static Log log = LogFactory.getLog(ScoutJaxrUddiHelper.class);
/**
* Get UDDI Address given JAXR Postal Address
*/
public static Address getAddress(PostalAddress post) throws JAXRException {
Address address = Address.Factory.newInstance();
AddressLine[] addarr = new AddressLine[6];
String stnum = post.getStreetNumber();
String st = post.getStreet();
String city = post.getCity();
String country = post.getCountry();
String code = post.getPostalCode();
String state = post.getStateOrProvince();
AddressLine stnumAL = AddressLine.Factory.newInstance();
stnumAL.setKeyName("STREET_NUMBER");
if (stnum != null) {
stnumAL.setKeyValue(stnum);
}
AddressLine stAL = AddressLine.Factory.newInstance();
stAL.setKeyName("STREET");
if (st != null) {
stAL.setKeyValue(st);
}
AddressLine cityAL = AddressLine.Factory.newInstance();
cityAL.setKeyName("CITY");
if (city != null) {
cityAL.setKeyValue(city);
}
AddressLine countryAL = AddressLine.Factory.newInstance();
countryAL.setKeyName("COUNTRY");
if (country != null) {
countryAL.setKeyValue(country);
}
AddressLine codeAL = AddressLine.Factory.newInstance();
codeAL.setKeyName("POSTALCODE");
if (code != null) {
codeAL.setKeyValue(code);
}
AddressLine stateAL = AddressLine.Factory.newInstance();
stateAL.setKeyName("STATE");
if (state != null) {
stateAL.setKeyValue(state);
}
// Add the AddressLine to vector
addarr[0] = stnumAL;
addarr[1] = stAL;
addarr[2] = cityAL;
addarr[3] = countryAL;
addarr[4] = codeAL;
addarr[5] = stateAL;
address.setAddressLineArray(addarr);
return address;
}