background image

Create a postal address

<< Specifying Postal Addresses | Running the Client Examples >>
<< Specifying Postal Addresses | Running the Client Examples >>
198
J
AVA
API
FOR
XML R
EGISTRIES
First, you specify the postal address scheme using the
id
value from the
JAXR-
ClassificationScheme
element (the UUID). Case does not matter:
props.setProperty("javax.xml.registry.postalAddressScheme",
"uuid:f7922839-f1f7-9228-c97d-ce0b4594736c");
Next, you specify the mapping from the
id
of each
JAXRConcept
element in the
default JAXR postal address scheme to the
id
of its counterpart in the scheme
you published:
props.setProperty("javax.xml.registry.semanticEquivalences",
"urn:uuid:PostalAddressAttributes/StreetNumber," +
"uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/
StreetAddressNumber|" +
"urn:uuid:PostalAddressAttributes/Street," +
"urn:uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/
StreetAddress|" +
"urn:uuid:PostalAddressAttributes/City," +
"urn:uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/City|" +
"urn:uuid:PostalAddressAttributes/State," +
"urn:uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/State|" +
"urn:uuid:PostalAddressAttributes/PostalCode," +
"urn:uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/ZipCode|" +
"urn:uuid:PostalAddressAttributes/Country," +
"urn:uuid:f7922839-f1f7-9228-c97d-ce0b4594736c/Country");
After you create the connection using these properties, you can create a postal
address and assign it to the primary contact of the organization before you pub-
lish the organization:
String streetNumber = "99";
String street = "Imaginary Ave. Suite 33";
String city = "Imaginary City";
String state = "NY";
String country = "USA";
String postalCode = "00000";
String type = "";
PostalAddress postAddr =
blcm.createPostalAddress(streetNumber, street, city, state,
country, postalCode, type);
Collection<PostalAddress> postalAddresses =
new ArrayList<PostalAddress>();
postalAddresses.add(postAddr);
primaryContact.setPostalAddresses(postalAddresses);