background image

Complex data item

<< Managing Registry Data | Adding Classifications >>
<< Managing Registry Data | Adding Classifications >>
M
ANAGING
R
EGISTRY
D
ATA
187
An
Organization
object is one of the more complex data items in the JAXR
API. It normally includes the following:
· A
Name
object.
· A
Description
object.
· A
Key
object, representing the ID by which the organization is known to
the registry. This key is created by the registry, not by the user, and is
returned after the organization is submitted to the registry.
· A
PrimaryContact
object, which is a
User
object that refers to an autho-
rized user of the registry. A
User
object normally includes a
PersonName
object and collections of
TelephoneNumber
,
EmailAddress
, and
Postal-
Address
objects.
· A collection of
Classification
objects.
·
Service
objects and their associated
ServiceBinding
objects.
For example, the following code fragment creates an organization and specifies
its name, description, and primary contact. When a client creates an organization
to be published to a UDDI registry, it does not include a key; the registry returns
the new key when it accepts the newly created organization. The
blcm
object in
the following code fragment is the
BusinessLifeCycleManager
object returned
in Obtaining and Using a RegistryService Object (page 180). An
Internation-
alString
object is used for string values that may need to be localized.
// Create organization name and description
InternationalString s =
blcm.createInternationalString("The Coffee Break");
Organization org = blcm.createOrganization(s);
s = blcm.createInternationalString("Purveyor of the " +
"finest coffees. Established 1950");
org.setDescription(s);
// Create primary contact, set name
User primaryContact = blcm.createUser();
PersonName pName = blcm.createPersonName("Jane Doe");
primaryContact.setPersonName(pName);
// Set primary contact phone number
TelephoneNumber tNum = blcm.createTelephoneNumber();
tNum.setNumber("(800) 555-1212");
Collection<TelephoneNumber> phoneNums =
new ArrayList<TelephoneNumber>();
phoneNums.add(tNum);
primaryContact.setTelephoneNumbers(phoneNums);